You are viewing a single comment's thread. Return to all comments →
what do u mean by previous element?
is it a[p-1]for a[p] or the previous state of a[p] before the current updation operation?
difference is betweentwo succesive elements or in the same element before and after one query is executed?
It is a[p-1] for a[p] ie. the difference between two successive elements.
Well ,now ,i understood my mistake . I was just adding the positive differences.
But the problem requires maximum element in an array , so there must be a comparison while adding the differences.