You are viewing a single comment's thread. Return to all comments →
Thanks polmki99! Very clever implementation.
Here it is in Javascript for those interested.
function processData(input) { //Enter your code here var inputList = input.split('\n'); var details = inputList[0].split(" "); var arrayIdx = inputList.slice(2); var targetArray = inputList[1].split(" "); var k = details[1]%details[0]; targetArray = [].concat(targetArray.slice(-k),targetArray.slice(0,-k)); arrayIdx.map(function(elem){return console.log(targetArray[elem]);}); }
Seems like cookies are disabled on this browser, please enable them to open this website
Circular Array Rotation
You are viewing a single comment's thread. Return to all comments →
Thanks polmki99! Very clever implementation.
Here it is in Javascript for those interested.