thank you sir for the editorial please keep posting such awesome contents for us to learn
I need some reputation points… Please upvote this comment /\
Official editorial is out… and here’s my solution which breaks the range in blocks of 60 and solves the problem.
can u explain the get function in your solution?
can u please explain the approach?
Will surely try to do that
@beginner_1111 if you follow the link I provided above, you can find a function named query()
in the beginning of the blog. It gives the result of a segment tree range query for range [l,r). Similar implementation is get()
which solves for range [l,r]. Notice that the whole blog follows 0-indexing.