You are given activities. Each activity has a start time and an end time . Two activities conflict if their time intervals overlap. Goal: Select the maximum number of non-overlapping activities.
Example: activities = [(1,4), (3,5), (0,6), (5,7), (8,9), (5,9)]. Which activities should you select? Before reading on, try to find the answer yourself. This problem appears in scheduling, resource allocation, and interval problems. The brute force approach of trying all subsets takes time, which is too slow.