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.
First, Intialize starting position k= k%2.
then,from this first postion (k) use a for loop till (n-1) to assign the values in the new array and finally use another for loop from 0 to (k-1).
the O(n) of this algorithm is n and it works for all test cases.
Circular Array Rotation
You are viewing a single comment's thread. Return to all comments →
First, Intialize starting position k= k%2. then,from this first postion (k) use a for loop till (n-1) to assign the values in the new array and finally use another for loop from 0 to (k-1).
the O(n) of this algorithm is n and it works for all test cases.