Total Accepted: 61150
Total Submissions: 300206
Difficulty: Easy
Rotate an array of _n_ elements to the right by _k_ steps.
For example, with _n_ = 7 and _k_ = 3, the array [1,2,3,4,5,6,7]
is rotated to [5,6,7,1,2,3,4]
.
Note:
Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.
Java:
1 | public class Solution { |