Sometimes interval queries map to segment tree operations.
Given intervals on a range , answer queries like: - "How many intervals cover point ?" - "What's the maximum overlap in range ?" Build a segment tree on positions to .
For each interval , do a range update: add 1 to all positions from to . To count intervals covering point : point query at .
This approach works when is small enough. For large , use coordinate compression.