You are viewing a single comment's thread. Return to all comments →
I didnt well understand that what will happen if b+1 is out of array bounds?
it can't be out of bounds, it saids that b>n in the problem statement.
if b+1 > n then the the addition of k from position a will continue till the last element of the array.