INTUIT OA QUESTION || 2022 NEW GRAD || HARD QUESTION
Anonymous User
1194

There was long story in the problem but to put it simply that boils down to this

solve 2 query efficiently

we have score defined for an array as:

score = A[0]*1 + A[1]*2 ....... A[N-1]*N

we have two types of queries

1 i v -> update the value at A[i] = v 
2 l r -> find the score of subarray [ A[l] , A[l+1] ,.... A[r] ]

constraints were not mentioned in the question but i suppose both query needed to be solve in Log(N) time as brute force was giving the TLE

PS: I could not solve it during the OA, Looking for some help how this type of questions can be solved

Comments (4)