PSHTRG [Unofficial Editorial] (Pishty and Triangles) MARCH LONG

thank you sir for the editorial :slight_smile: please keep posting such awesome contents for us to learn :slight_smile:

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 :slight_smile:

@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.