class Solution { public int minMeetingRooms(int[][] intervals) { Arrays.sort(intervals, (a,b) -> a[0] - b[0]); PriorityQueue pq = new PriorityQueue<>(); int res = 0; int maxSize = 0; for(int[] i : intervals) { while (!pq.isEmpty() && pq.peek() <= i[0]) { pq.poll(); } pq.offer(i[1]); if (pq.size() > maxSize) { maxSize = pq.size(); res = i[0]; } } System.out.println("Max overlap was at " + res); return maxSize; } }