Problem · String
Reverse a String
Learn this problemProblem statement
Given a string s, return a new string containing the same characters in reverse order.
Character case and all non-letter characters must be preserved.
Function
reverseString(s: String) → StringExamples
Example 1
s = "FastPrep"return = "perPtsaF"Reading the input from right to left produces perPtsaF.
Example 2
s = "hello"return = "olleh"