Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(arr) {
- "use strict";
- let numberOfRotations = arr.pop();
- numberOfRotations = Number(numberOfRotations);
- numberOfRotations %= arr.length;
- for(let i = 0; i < numberOfRotations; i++) {
- let lasElement = arr.pop();
- arr.unshift(lasElement);
- }
- console.log(arr.join(' '));
- }
Advertisement
Add Comment
Please, Sign In to add comment