Array Rotation
Easy
Arrays
Array
Rotate array to the right by k steps. Print result space-separated.
Constraints
1 ≤ nums.length ≤ 10^5
Examples
Example 1:
Input: 1 2 3 4 5 6 7
3
Output: 5 6 7 1 2 3 4
Example 2:
Input: -1 -100 3 99
2
Output: 3 99 -1 -100
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console