Reverse String Problem

Reverse String Problem — ExecCode Easy DSA Practice

Solve the Reverse String problem on ExecCode. Free online easy DSA practice in Two Pointers. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Reverse the given character array in place. Use one pointer at the beginning and one pointer at the end, swap those two characters, then move both pointers inward until they meet.

Examples

Input s = ["h","e","l","l","o"]; Output ["o","l","l","e","h"]. Input s = ["A","b","9","z"]; Output ["z","9","b","A"]

Constraints

1 <= s.length <= 10^5 s[i] is a printable ascii character.

Practice Reverse String free on ExecCode. Browse DSA problems, topic map, and placement guides.