Reverse String
Given a string s, return a new string with its characters in the opposite order.
For an empty string, return an empty string.
Example 1
s "hello"
returns "olleh"
Read the letters from the end: olleh.
Example 2
s "ab"
returns "ba"
Constraints
0 <= len(s) <= 100shas letters, digits and spaces
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Strings problems
- Snake Case to Camel CaseBeginner
- Stretch Each CharacterBeginner
- Student Attendance RecordBeginner
- Sum of Digits in TextBeginner
- Truncate SentenceBeginner
- Two String Lists Spell the Same WordBeginner
- Vowel and Consonant TallyBeginner
- Abbreviate Long WordsEasy