• + 1 comment

    Hi, your solution works but I am not convinced!

    I don't see how do you increment all elements between lower and upper!

    • arr[lower-1]+=sum; This only increments the lower element by sum.
    • if(upper
    • arr[upper]-=sum; I don't understand why are you substructing sum!

    Can you please explain? Thanks.