You are viewing a single comment's thread. Return to all 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.
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 →
What about if 'k' is greater than 'n'? You should use modular arithmetic to get actual rotate count.
Then your solution would work for every k values.