33 · Intervals

#252 Meeting Rooms

frequently reported atMetaAmazonGoogleBloomberg

the problem

In plain words

Each meeting is [start, end): it takes the time from start up to, but not including, end. Can one person attend all of them? A meeting that ends at 10 and one that starts at 10 don't clash.

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

out false

[0,30] clashes with both of the others.

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

out true

  • 0 ≤ 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. #253
      Meeting Rooms II
      Mediumin IntervalsLeetCode Premium
    2. #56
      Merge Intervals
      Mediumin Intervals