Back to Home

Intervals

Interval problems involve working with ranges defined by start and end points. Common operations include merging overlapping intervals, inserting new intervals, and finding intersections. The key insight is usually to sort intervals by start time and process them sequentially.

6
Problems
1
Easy
5
Medium
0
Hard

Core Concept

Sort intervals by start time. Overlapping intervals have the property that the next interval starts before the current one ends.

Key Insight

Two intervals [a,b] and [c,d] overlap if and only if a <= d AND c <= b. After sorting, just check if next.start <= current.end.

Common Pattern

Sort by start time, iterate through intervals, and either merge overlapping intervals or count conflicts based on the problem requirements.