You are viewing a single comment's thread. Return to all comments →
ts solution:
function circularArrayRotation(a: number[], k: number, queries: number[]): number[] { for(let i=0; i<k; i++){ let popped = a.pop() ?? 0; a.unshift(popped); } return queries.map(i => a[i]); }
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 →
ts solution: