Write a function that reverses a character array in-place. You must do this with O(1) extra memory.

Input: ["h","e","l","l","o"] → Output: ["o","l","l","e","h"]Input: ["H","a","n","n","a","h"] → Output: ["h","a","n","n","a","H"]

Classic two-pointer swap: pointers at both ends, swap and move inward.

class Solution { public void reverseString(char[] s) { int lo = 0, hi = s.length - 1; while (lo < hi) { char tmp = s[lo]; s[lo] = s[hi]; s[hi] = tmp; lo++; hi--; } } }