Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike
2,029 views
in Online Assessments by Expert (144,420 points)

1 Answer

0 like 0 dislike
 
Best answer

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] ]
by Expert (144,420 points)
...