Last active
January 28, 2020 10:39
-
-
Save laddered/78c1b4902a1cad938c33b2538bac92aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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