Your question is Frequency Counter or Array Rotation. 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.
A Finastra Fusion processing component receives payment records in chronological order. Given an array of records and a non-negative integer k, rotate the array to the right by k positions in place, then return the modified array.
Implement rotate_array(nums, k) where nums is a mutable list of integers and k is an integer. The function must modify nums directly and return the same list object. If k is larger than the array length, reduce it using modulo arithmetic.
Use only O(1) additional space apart from a constant number of variables.
def rotate_array(nums, k):