Generate to see activity selection
Generate to see greedy steps.
1x
Ready
Algorithm Details
Generate to see greedy steps.
Activity selection
Time
O(n log n)
Space
O(1)
Greedy choice
1sort by end time2pick first, last_end = end3for each (start, end):4 if start >= last_end:5 pick, last_end = end