Please explain the public section of the solution.
Read this with patience. It’s a great editorial for someone who wants to learn segment trees. The public section of the solution which you mentioned mainly performs two functions - Updates the segment tree (see the private section below for the working of the function change()
), and queries the segment tree between l
and r
. I suggest you to read the editorial carefully and follow the steps, which will makes things clear.
List of problems using segment tree of easy and medium difficulty along with some great resources to learn can be found here.
1 Like