Reverse an array with least time complexity.
Implement reverse_array(nums) to reverse the input list in place and return the same list. Use no auxiliary array. The expected solution should run in O(n) time and O(1) extra space.
Input: A list of integers nums.
Output: The reversed list.
def reverse_array(nums):