You are viewing a single comment's thread. Return to all comments →
In js, I tried a different approach. In node.js, it has no difference in performance when it is compared to other approach.
function rotLeft(a, d) { let i = 0, j = i + d; let arr = []; while (i < a.length) { if (j < a.length) { arr[i] = a[j]; j++; } else { j = 0; } i++; } return arr; }
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
In js, I tried a different approach. In node.js, it has no difference in performance when it is compared to other approach.