Last active
March 24, 2017 12:19
-
-
Save Obre/863ae67520c5ee2532159c52f3a901c8 to your computer and use it in GitHub Desktop.
This file contains 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 !== undefined && A.length > 0) | |
{ | |
for(let i =0; i < K; i++){ | |
A.unshift(A.pop()); | |
//unshift add element/s to begin of array and returns length of new array | |
//pop removes last element and returns that element (changes length of array) | |
} | |
} | |
return A; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment