Reverse String
Easy
Strings
String
Two Pointers
Given a string s, return the reversed string.
Constraints
1 ≤ s.length ≤ 10^5
Examples
Example 1:
Input: hello
Output: olleh
Example 2:
Input: Hannah
Output: hannaH
Hints
Use two pointers from both ends.
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console