Your question is Rotate Array Right. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
SDG&E's outage-monitoring pipeline stores ordered telemetry readings in an integer array. Given the readings and a nonnegative integer k, rotate the array to the right by k positions in place, preserving the relative order of the moved elements.
Implement rotate(nums, k), where nums is a mutable list of integers and k is the number of right rotations. Modify nums directly and return None. A right rotation moves the final element to index 0 and shifts every other element one position to the right.
Your solution should use constant extra space apart from a fixed number of variables.
def rotate(nums, k):