Warm-ups · 13 of 24
Reverse a string (no built-in reverse)
Return the string reversed, without using a built-in reverse (no [::-1], reversed() or .reverse()).
Examples
Input s = "hello"
Output "olleh"
Input s = "ab cd"
Output "dc ba"
Spaces are characters too.
📘 New to this? Two pointers from opposite ends explains the idea in a few minutes.
Solved it? The same idea on LeetCode: try it there ↗