• + 1 comment

    It's a difference array. He is storing the difference/the changes that should be made in each index and then runs a loop to add up all these changes. You increment the lower bound because everything inbetween the lower and upper bound should be incremented but you dont want this change to continue for the rest of the array so you decrement at (upper+1).

    • + 0 comments

      but how can we know about the upper index of a particular increment,when we are adding all at a once in a loop?