Given an array of characters chars, reverse the array in place and return it. The solution must modify the input array directly using O(1) extra space.
Example 1:
Input: chars = ["h", "e", "l", "l", "o"]
Output: ["o", "l", "l", "e", "h"]
Explanation: Swapping characters from both ends reverses the array.
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 printable character