
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How can you efficiently add intervals to the set of intervals? Can a data structure like a Binary Search Tree help?
How can you ensure that the intervals present in the set are non-overlapping? Try merging the overlapping intervals whenever a new interval is added.
How can you update the count of integers present in at least one interval when a new interval is added to the set?