Skip to content

Instantly share code, notes, and snippets.

@laddered
Last active January 28, 2020 10:39
Show Gist options
  • Save laddered/78c1b4902a1cad938c33b2538bac92aa to your computer and use it in GitHub Desktop.
Save laddered/78c1b4902a1cad938c33b2538bac92aa to your computer and use it in GitHub Desktop.
function solution(A, K) {
if(A.length%K){
for(let i=0; i<K; i++){
lastNumber=A.pop()
A.unshift(lastNumber)
}
}
return A
}
function solution(A, K)
{
for (i = 0; i < K && A.length; i++){
A.unshift(A.pop());
}
return A;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment