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.
I have uploaded a video tutorial which can help you to understand the problem as well as logic.
Here is the video tutorial for my solution O(n+m) complexity.
Would really appreciate your feedback like, dislike , comment etc. on my video.