public int minMeetingRooms(Interval[] intervals) {
        if (intervals.length == 0) {
            return 0;
        }
        Arrays.sort(intervals, (a, b) ->  a.start - b.start);
        PriorityQueue<Interval> pq = new PriorityQueue<>((a, b) -> a.end - b.end);
        pq.offer(intervals[0]);
        int rooms = 1;
        for (int i = 1; i < intervals.length; i++) {
            Interval it = pq.poll();
            if (it.end <= intervals[i].start) {
                it = new Interval(it.start, intervals[i].end);
            } else {
                rooms++;
                pq.offer(intervals[i]);
            }
            pq.offer(it);
        }
        return rooms;
    }
Date 05/01/2016
@author Tushar Roy

Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei),
find the minimum number of conference rooms required.

Both methods have time comlexity of nlogn
Method 1 has space complexity of O(1)

https://leetcode.com/problems/meeting-rooms-ii/
src/com/interview/array/MeetingRooms.java