MTRICK Problem

My solution was BIT. But It’s get’s many time.
I think my solution is better than tester solution.

How i can optimism time.
Any suggestion About my solution.

Your solution will take logn time to do each operation…but keeping some additional variables for counting the cumulative values for each operation can be done in constant time…
you can refer my solution here