How to Reverse a String

How to Reverse a String

The only way to get better at solving algorithms and data structures is to power through a few. Can you write a function that reverses an inputted string without using the built-in Array#reverse method?

Can you write a function that reverses an inputted string without using the built-in Array#reverse method?

Let’s look at some examples. So, calling:

reverseString("jake") should return "ekaj".

reverseString("reverseastring") should return "gnirtsaesrever".

Image for post

This lesson was originally published at [https://algodaily.com_](, where I maintain a technical interview course and write think-pieces for ambitious developers._

True or False?

In Java, C#, JavaScript, Python and Go, strings are immutable. This means the string object's state can't be changed after creation.

Solution: True

On Interviewer Mindset

Reversing a string is one of the most common technical interview questions that candidates get. Interviewers love it because it’s deceptively simple. After all, as a software engineer, you’d probably call the #reverse method on your favorite String class and call it a day!

So don’t overlook this one — it appears a surprising amount as a warm-up or build-up question. Many interviewers will take the approach of using an easy question like this one, and actually judge much more harshly. You’ll want to make you sure really nail this.

How We’ll Begin Solving

We want the string reversed, which means that we end up with all our letters positioned backwards. If you need a quick review of `string_`_s, check out [our lesson on arrays and strings_](

data-structures technical-interview programming javascript algorithms

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Data structures and algorithms for interviews 

An interview for a coding/software position is incomplete without a coding interview. Here’s an explanation for common problems asked

Why Data Scientists Should Learn Algorithms and Data Structures?

Understanding concepts such as algorithmic complexity and proper use of data structures will enable you to write more optimal code. I will list a few tools you will have under your tool-belt after taking a typical algorithms course.

Algorithms and Data Structures in JavaScript

JavaScript implementation of data-structures and algorithms mentioned in this playlist may be found here

Python Data Structures: Your Starter Kit to Learning Algorithms

Arrays, Linked Lists, Stacks, Queues and Hash Tables. Working with any kind of algorithm starts with learning a set of data structures associated with it.

Python Data Structures: Your Starter Kit to Learning Algorithms

This is just meant as a friendly introduction to a topic that every computer science and data science program I know off explores in an entire course or a few.