• + 1 comment

    Can you explain this line

    differenceArray[a] += k; if (b+1<=N) differenceArray [b+1] -= k; }

    Why are you adding k to only differenceArray[a]??