← All problemsExample 1 Example 2
Problem
Reverse a String
Easy- strings
Return str with its characters in the opposite order.
- Input
str = "hello"- Output
"olleh"- Explanation
the last letter comes first and the first letter comes last.
- Input
str = ""- Output
""- Explanation
an empty string has nothing to reorder.
Constraints:
0 <= str.length <= 10^4
Tab indents. Press Esc, then Tab to leave the editor.
Ctrl or ⌘ + Enter runs the tests.
Run your code to see every test here. Nothing is submitted or recorded.