@Richardo92 I don't think this is called O(n) solution, since n is the length of array, not the minutes. If the one interval is about from 0 to 2M or 2G, then your algorithm is not gonna work well.
We should consider in this way.
What will be the longest time for a meeting?
When the number of meetings n increases, will this longest time start to increase, either?
It will stay same.
So when the number of meetings n increases, the time of meeting will stay constant, say 100, 1000, 10000 or more, But it doesn't matter, right? We can find a constant which is bigger than the longest time of one meeting.
So the total time complexity should be O(n)
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.