N meetings in one room (GeeksforGeeks)
You are given timings of n meetings in the form of (start[i], end[i]) where start[i] is the start time of meeting i and end[i] is the finish time of meeting i. Return the maximum number of meetings that can be accommodated in a single meeting room, when only one meeting can be held in the meeting room at a particular time.
Note: The start time of one chosen meeting can't be equal to the end time of the other chosen meeting.
I was unable to understand the logic behind this at first so I had to take a look at the solution 😖 ,
1. Sort the meetings based on their end times.
2. Initialize a counter for the maximum number of meetings.
3. Keep track of the end time of the last selected meeting.
4. Iterate through the meetings and select those that start after the last selected meeting ends.
#geekstreak2024