Zero To DSAZero To DSA
Privacy Policy
Best Time to Buy and Sell Stock II

Meeting Rooms II

medium
Time: O(n log n)
Space: O(n)

Given an array of meeting time intervals where each interval is [start, end], return the minimum number of conference rooms required.

Constraints

  • 0 <= intervals.length <= 10⁴

Examples

Input: intervals = [[0,30],[5,10],[15,20]]
Output: 2
Input: intervals = [[7,10],[2,4]]
Output: 1