Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void rotate(int[] nums, int k) {
- int temp, previous;
- for (int i = 0; i < k; i++) {
- previous = nums[nums.length - 1];
- for (int j = 0; j < nums.length; j++) {
- temp = nums[j];
- nums[j] = previous;
- previous = temp;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement