Medium · Intervals

Non-overlapping Intervals

You are given a list of intervals. Return the smallest number of them you would have to remove so that none of the rest overlap.

  • Each interval is [start, end] with start less than end.
  • Intervals that only touch, like [1, 2] and [2, 3], do not overlap.
  • The list is in no particular order.
intervals = [[1, 2], [2, 3], [3, 4], [1, 3]]

→ 1   (remove [1, 3])
Record your take

No one has solved it yet.