I came across this problem online which is a Leetcode premium problem. Most of the people are solving this using *Minheap*. *To me using minHeap for this seems like repetitive way to solve a problem* if we can achieve the same thing just by sorting the array based on startTimes & than checking if meeting(i).endTime > meeting(i+1).startTime. Increment if the aforementioned condition is true.

I don’t have access to leetcode premium so I can’t verify if the following solution would suffice.

Am I missing something here?

**Problem Statement:**

```
public int minMeetingRooms(List<Interval> intervals) {
// Write your code here
if(intervals == null || intervals.size() == 0)
return 0;
Collections.sort(intervals, (meeting1, meeting2) -> meeting1.start-meeting2.start);
int rooms = 1;
for(int i=0; i<intervals.size()-1; i++) {
if(intervals.get(i).end > intervals.get(i+1).start)
rooms++;
}
System.out.println("rooms required: "+ rooms);
return rooms;
}
```