Advertisement
Spocoman

03. Rotate Array

Jan 23rd, 2022
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.  
  3.     let print = input.slice(0, input.length - 1);
  4.  
  5.     for(let i = 0; i < Number(input[input.length - 1]); i++) {
  6.         print.unshift(print.pop());
  7.     }
  8.     console.log(print.join(" "));
  9.  
  10. }
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement