We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
And array_left_rotation only takes O(k) instead of O(n).
Note that a is pased by reference, so there is no need to return anything, but this could be an issue for some user cases, for this particular problem, it works.
Cookie support is required to access HackerRank
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 →
You have O(n) in:
In order to avoid this, you should use a deque from the beginning like:
And array_left_rotation only takes O(k) instead of O(n).
Note that a is pased by reference, so there is no need to return anything, but this could be an issue for some user cases, for this particular problem, it works.