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.
That extra %N was added so that if our ans turns out to be greater than the number of elements in the array , the indexing should again start from index '0'.
eg. for m=1, our the later formula without using %N will result to 5.
but our ans should be equal to 0 and not 5 thats why we do modulus.
so that it could become 0
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Circular Array Rotation
You are viewing a single comment's thread. Return to all comments →
That extra %N was added so that if our ans turns out to be greater than the number of elements in the array , the indexing should again start from index '0'. eg. for m=1, our the later formula without using %N will result to 5. but our ans should be equal to 0 and not 5 thats why we do modulus. so that it could become 0