public class Solution {
public int minMeetingRooms(Interval[] intervals) {
int[] starts = new int[intervals.length];
int[] ends = new int[intervals.length];
for(int i=0; i<intervals.length; i++) {
starts[i] = intervals[i].start;
ends[i] = intervals[i].end;
}
Arrays.sort(starts);
Arrays.sort(ends);
int rooms = 0;
int endsItr = 0;
for(int i=0; i<starts.length; i++) {
if(starts[i]<ends[endsItr])
rooms++;
else
endsItr++;
}
return rooms;
}
}
Super Easy Java Solution Beats 98.8%


Very nice, that lazy releasing of rooms. Here are two Python versions, each got 64 ms on first submission, beating 99.42%.
def minMeetingRooms(self, intervals): ends = sorted(i.end for i in intervals) rooms = ended = 0 for start in sorted(i.start for i in intervals): if start < ends[ended]: rooms += 1 else: ended += 1 return rooms def minMeetingRooms(self, intervals): ends = sorted(i.end for i in intervals)[::1] rooms = 0 for start in sorted(i.start for i in intervals): if start < ends[1]: rooms += 1 else: ends.pop() return rooms

@StefanPochmann
I like that name: "lazy releasing"! It tell us vividly what happen.