Approach Summary
Sort by end time. Greedily keep intervals with the earliest end. Count how many must be removed (total - kept).
How to Recognize This Pattern
- "Minimum intervals to remove so none overlap"
- Greedy: always keep interval with earliest end time
Complexity Analysis
Time Complexity
O(n log n)
Space Complexity
O(1)
Tags
Array Greedy Dynamic Programming Sorting