We are given an array 'a' of size N. We have 2 type of query Type 1 :- i , x update a[i] with a[i]+x Type 2:- i Give output S. Where S = a[0]+a[1]+.....+a[i] Constraint:- N<=100000 Q<=100000 Where N = size of array Q=Number of query
Example a={1,2,3,4,5,6} Type 1: 0,5 Type 2: 3 Type 1: 4,3 Type 2: 5
Output: 15 29
Is this from a running contest?
One of friend asked me this question.
Segment trees.
Please explain the idea. Is it a standard question??
Can you share the resources?? Please...
Assuming that such a straightforward question is not from a stupid running contest.
Thanks...:)