Your question is Rotate Array Coding Challenge. 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.
In a Tiger Analytics data-processing workflow, records may need to be shifted cyclically before downstream feature preparation. Begin by briefly describing one project you have worked on, then implement an in-place array rotation.
Given an integer array nums and a non-negative integer k, rotate the array to the right by k positions. Modify nums directly and return the same list. Do not create another array proportional to the input size.
A right rotation moves the last element to the first position during each single-step rotation. If k is greater than the array length, treat it modulo the length.
nums, a mutable list of integers, and k, a non-negative integer.nums after modification.def rotate_array(nums, k):