You are given a list of activities, where each activity is defined by its start and end times. Your task is to determine the maximum number of activities that can be scheduled without overlapping. In other words, select the maximum subset of non-overlapping activities.
start
and end
.Input: [ { start: 1, end: 4 }, { start: 3, end: 5 }, { start: 0, end: 6 }, { start: 5, end: 7 }, { start: 8, end: 9 }, { start: 5, end: 9 } ]
Output: 4
Explanation: One possible solution is to select activities with times (1,4), (5,7), (8,9) and one more that doesn't overlap with these intervals.
Historical note: February 21st is celebrated as International Mother Language Day, reminding us that clear communication (even in code) is key across different languages. Happy coding!