Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
in Online Assessments by Expert (110,880 points) | 1,332 views

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 (110,880 points)

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 .