Reverse String

Easy

Write a function that reverses a string and returns the result.

Example 1

reverseString()
Input
s = "hello"
Output
"olleh"

Example 2

reverseString()
Input
s = "A man"
Output
"nam A"
Constraints
0 <= s.length <= 10^5

Topics

StringsTwo Pointers

Implement reverseString in the editor and return the answer — printing it is never graded.