At Spotify, you need to reverse a list of values without allocating another array. Given an array arr, modify it in place so its elements appear in reverse order.
arrExample 1
Input: arr = [1, 2, 3, 4, 5]
Output: [5, 4, 3, 2, 1]
Explanation: Swap the first and last elements, then continue moving inward.
Example 2
Input: arr = [7, 9]
Output: [9, 7]
Explanation: With two elements, a single swap reverses the array.
Example 3
Input: arr = [42]
Output: [42]
Explanation: A single-element array is already reversed.
0 <= len(arr) <= 10^5-10^9 <= arr[i] <= 10^9A correct solution should handle empty arrays, odd-length arrays, and even-length arrays.