RK DSA Studio

Interval scheduling

Select as many non-overlapping, unweighted intervals as possible by repeatedly choosing the earliest compatible finish.

Remember: Finish early; leave room.

Example: [1,2), [2,3), [1,4) → choose the first two.

Time: O(n log n). Auxiliary space: O(n).

Formula: Sort by finish; accept if start ≥ last selected finish

Up to 12 matching start/end pairs; start < end. Half-open intervals [start,end) permit touching endpoints. Maximize interval count, not total duration or weight. Stable original-index tie breaking; sorting and selected output storage are included.

Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.

The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.