33 · Intervals

#253 Meeting Rooms II

frequently reported atNetflixByteDance / TikTokAtlassianOracleBloombergApple

the problem

In plain words

Each meeting is [start, end). Return the minimum number of rooms needed to hold all of them. A room freed at 10 can host a meeting that starts at 10.

in intervals = [[0,30],[5,10],[15,20]]

out 2

[0,30] needs its own room; [5,10] and [15,20] can share the other.

in intervals = [[7,10],[2,4]]

out 1

  • 1 ≤ intervals.length ≤ 10⁴
  • 0 ≤ start < end ≤ 10⁶

your turn

Try it before you peek

Read the examples, say the brute force out loud, then write code right here. Stuck for 20 minutes? Open one hint at a time.

This one is LeetCode Premium. You don't need a subscription: solve it right here. The free alternative linked above is the closest free practice; its label says how close it is.

Solve it in the browser

LeetCode-style: complete the class. Compiled by the real javac (Java 17) and judged right here — nothing is sent anywhere.

    Solutions are hidden so you can try first. Even 20 minutes of real effort makes the answer stick far better than reading it.

    Marking the problem solved, or opening every hint, also shows it.

    practise next

    Similar problems

    1. #252
      Meeting Rooms
      Easyin IntervalsLeetCode Premium
    2. #1094
      Car Pooling
      Mediumin Intervals
    3. #621
      Task Scheduler
      Mediumin Heaps