Rotate Array
Given an array, rotate the array to the right by k steps, where k is non-negative.
Follow up:
Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.
Could you do it in-place with O(1) extra space?
Example 1:
Example 2:
Constraints:
1 <= nums.length <= 2 * 10^4
It's guaranteed that
nums[i]
fits in a 32 bit-signed integer.k >= 0
Last updated