You are viewing a single comment's thread. Return to all comments →
Super weird but checked twice
function rotLeft(a, d) { const headIndex = d % a.length const head = a.splice(0, headIndex) return a.concat(head) // fails test 9 as it creates a new array }
function rotLeft(a, d) { const headIndex = d % a.length const head = a.splice(0, headIndex) a.push(...head) return a // passes test 9 as it modifies initial array }
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 →
Super weird but checked twice