Try all subsets of intervals, check which are non-overlapping, find the largest subset.
With intervals, subsets to check. Exponential time.
Can you greedily decide which intervals to keep?
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
The trap
Try all subsets of intervals, check which are non-overlapping, find the largest subset.
With intervals, subsets to check. Exponential time.
Can you greedily decide which intervals to keep?