Why it matters
Interval scheduling teaches greedy vs DP. Understanding shapes technique choice.
Advertisement
The architecture
Unweighted: sort finish + greedy.
Weighted: DP with binary search.
Advertisement
How it works end to end
Weighted DP: dp[i] = max(dp[i-1], v_i + dp[p(i)]) where p(i) = last non-conflicting.
Sort by finish; binary search for p(i).