You are viewing a single comment's thread. Return to all comments →
my solution in js
function leftRotation(a,n,d) { var array = []; for (var i = 0; i < n; i++) { array[(i + (n-d)) % n] = parseInt(a[i]); } return array; } function main() { var n_temp = readLine().split(' '); var n = parseInt(n_temp[0]); var d = parseInt(n_temp[1]); a = readLine().split(' '); a = a.map(Number); var result = leftRotation(a,n,d); console.log(result.join(" ")); }
Seems like cookies are disabled on this browser, please enable them to open this website
Left Rotation
You are viewing a single comment's thread. Return to all comments →
my solution in js