Ivankooo1

easy Rotation

Dec 30th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function rotate(arr,r){
  2.  
  3.  
  4.   for(let i = 0;i < r;i++){
  5.     let firstEl = arr.shift();
  6.     arr.push(firstEl);
  7.        
  8.   }
  9.  
  10.   console.log(arr.join(' '));
  11. }
  12.  
  13. solve([1,2,3,4,5],[2])
Advertisement
Add Comment
Please, Sign In to add comment