dsa · easy
Reverse String
GreyOrangeStringTwo PointersFoundation
Reverse a list of characters **in place** and return it.
Arguments
s— the input string (or list of characters, if reversing in place)
**Example:** ["h","e","l","l","o"] → ["o","l","l","e","h"].
Constraints
1 <= s.length <= 10^5 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.
Examples
Example 1
Input: ["h","e","l","l","o"] Expected: ["o","l","l","e","h"]
Example 2
Input: ["H","a"] Expected: ["a","H"]