You are viewing a single comment's thread. Return to all comments →
TS solution
let n = k % a.length; let temp1 = a.slice(a.length-(n), a.length); let temp2 = a.slice(0, a.length-(n)); a = [...temp1, ...temp2] let newArr: number[] = []; queries.map((num)=>{ newArr.push(a[num]); }) return newArr;
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