Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = [
- '2,1,3,4',
- '5',
- ];
- let print = this.print || console.log;
- let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- let nums = gets().split(',');
- let n = gets();
- function rotate(nums, n) {
- n = n % nums.length;
- return nums.slice(n).concat(nums.slice(0, n))
- }
- print(rotate(nums, n));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement