Arrays: Left Rotation

  • + 0 comments
    function rotLeft(a: number[], d: number): number[] {
       return [ ...a.slice(d), ...a.slice(0, d)]
    }