You are given a string represented as a list of characters s.
Your task is to reverse the string in-place, meaning you must modify the input array directly without using extra memory beyond O(1) space.
You must complete the reversal by swapping characters rather than creating a new list.
Input: s = ["p", "y", "t", "h", "o", "n"]
Output: ["n", "o", "h", "t", "y", "p"]
Input: s = ["O", "p", "e", "n", "A", "I"]
Output: ["I", "A", "n", "e", "p", "O"]
Input: s = ["c", "o", "d", "i", "n", "g"]
Output: ["g", "n", "i", "d", "o", "c"]
Accepted:
Submission: