Skip to main content

Reverse String

JUNIOR
FacebookApple

Write a function that reverses a string. The input string is given as an array of characters.

You must do this by modifying the input array in-place.

Example:

Input: s = ["h", "e", "l", "l", "o"]
Output: ["o", "l", "l", "e", "h"]

Examples:

Input 1:{"s":["h","e","l","l","o"]}
Output 1:["o","l","l","e","h"]
Input 2:{"s":["H","a","n","n","a","h"]}
Output 2:["h","a","n","n","a","H"]

Loading editor...

Run your code to see results

Click the Run button above