• + 0 comments

    The most simpe solution I could think of

    Swift: func rotateLeft(d: Int, arr: [Int]) -> [Int] { let movedIdx = d % arr.count //get amount of index 0 shift return arr.dropFirst(movedIdx) + arr.dropLast(arr.count - movedIdx) }