Apologies if this kind of question is not allowed here.
I came across this question: "Given a list of intervals representing the start and end time of ‘N’ meetings, find the minimum number of rooms required to hold all the meetings.". I solved it by finding the max number of intersecting intervals.
But in the answer section it is using min heap to keep track of meetings' end time and removing all the meetings that have ended and returns the max size that the min heap have reached at any point. What am I missing please?
Why using min heap is more efficient/the ideal answer?
Both solutions have O(nlogn) time complexity. Space complexity is the same for both answer mine is a little more efficient as I only need space for sorting.
I have attached both answers. Thanks in advance