Given an array of characters chars, reverse the array in place and return it. The reversed result must contain the same characters in opposite order, and the solution should use constant extra space aside from the input array.
Example 1:
Input: chars = ["h", "e", "l", "l", "o"]
Output: ["o", "l", "l", "e", "h"]
Explanation: The characters are reversed by swapping from both ends toward the center.
Example 2:
Input: chars = ["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(chars) <= 10^5chars[i] is a single characterO(1) extra space beyond the input array