Arrays: Left Rotation

  • + 0 comments

    What about if 'k' is greater than 'n'? You should use modular arithmetic to get actual rotate count.

    actual_rotate_count = k % n

    Then your solution would work for every k values.