At Spotify, a text-processing utility stores strings as mutable character arrays. Write a function that reverses the array in place without allocating another array for the result.
Given a list of characters s, modify s so that its characters appear in reverse order.
s — a list of single-character stringss directly and return None.Example 1
Input: s = ["h", "e", "l", "l", "o"]
Output: ["o", "l", "l", "e", "h"]
Explanation: Swapping from both ends reverses the array in place.
Example 2
Input: s = ["H", "a", "n", "n", "a", "h"]
Output: ["h", "a", "n", "n", "a", "H"]
Explanation: The first and last characters are swapped, then the process continues inward.
1 <= len(s) <= 10^5s is a single printable characterO(1) extra space