Given an integer array nums, reverse the array in-place and return it.
You must not allocate extra space for another array. Modify the input array directly using O(1) extra memory.
Input: An integer array nums of length n.
Output: The same array nums reversed in-place.
Input: [1,2,3,4,5]
Output: [5,4,3,2,1]
Explanation: left=0, right=4: swap(1,5) → [5,2,3,4,1]
left=1, right=3: swap(2,4) → [5,4,3,2,1]
left=2 = right=2: stop. Return [5,4,3,2,1].Input: [1,2,3,4,5,6]
Output: [6,5,4,3,2,1]
Explanation: swap(1,6), swap(2,5), swap(3,4). left crosses right. Done.Input: [7]
Output: [7]
Explanation: Single element — no swaps needed. Return [7].1 <= nums.length <= 10^5-10^9 <= nums[i] <= 10^9