A Crowe analytics workflow receives an in-memory sequence of integer values that must be shifted cyclically before processing. Given an array nums and a nonnegative integer k, rotate the array to the right by k positions, modify the array in place, and return it.
Use constant auxiliary space. Since rotating by the array length produces the original array, reduce k before performing the rotation.
nums, a list of integers, and k, a nonnegative integer.k positions.(current_index + k) % len(nums).def rotate_array(nums, k):