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.
If "d" is greater than "n" , for example take n=5 and d = 10
let me take arr[5] = {1,2,3,4,5}
for 10 rotations ans should be same right but it does not work!!!
5 10
1 2 3 4 5
ans : 1 1878011968 1329038170 32 16.
so this method does not work for the case where the number of rotation is larger than array size!!!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Left Rotation
You are viewing a single comment's thread. Return to all comments →
If "d" is greater than "n" , for example take n=5 and d = 10 let me take arr[5] = {1,2,3,4,5} for 10 rotations ans should be same right but it does not work!!! 5 10 1 2 3 4 5 ans : 1 1878011968 1329038170 32 16.
so this method does not work for the case where the number of rotation is larger than array size!!!