Example 1
Input
chars = ["h", "e", "l", "l", "o"]
Output
["o", "l", "l", "e", "h"]
Loading CodeSprint...
/problems/reverse-characters
Return a new array containing the supplied characters in reverse order.
Implement this function and return the result. CodeSprint supplies each test case automatically.
reverseString(chars) → string[]Input
chars = ["h", "e", "l", "l", "o"]
Output
["o", "l", "l", "e", "h"]
Input
chars = ["A", "B"]
Output
["B", "A"]
Constraints
0 <= chars.length <= 100,000 Each entry is a single character string.