344 Reverse String
344. Reverse String
1. Question
Write a function that takes a string as input and returns the string reversed.
Example: Given s = "hello", return "olleh".
2. Implementation
(1) Two Pointers
3. Time & Space Complexity
Two Pointers: 时间复杂度O(n), 空间复杂度O(1)
Last updated