You are viewing a single comment's thread. Return to all comments →
Sorry, but in this line
aK[m] == a0[(m+N-(K%N))%N].
you %N again after +N for what purpose? If i think correctly, it's for rotate again the m index?
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