JavaScript Algorithm: Simple String Reversal

Reverse the portion of a string between two given indices

Max N
Level Up Coding
Published in
2 min readMay 6, 2021

--

Photo by Monty Allen on Unsplash

We are going to write a function called solve that will accept a string, st, and two integers, a and b, as arguments.

You are given a string and two indices. The goal of the function is to reverse only the portion of the string between (and including) those indices…

--

--

A writer that writes about JavaScript and Python to beginners. If you find my articles helpful, feel free to follow.