Netflix questions

Closed Interval Overlap

NetflixPhone screenMedium

A closed integer interval [start, end] covers every integer x with start <= x <= end. Equal intervals each count separately. Implement the function closed_interval_overlap.

Part 1: The busiest point

Given a list of closed integer intervals intervals, return a list with one entry: the largest number of intervals that cover any single point.

  1. Example 1
    intervals
    [[1,3],[2,5],[5,7]]
    Output
    [2]

    Why: The points 2, 3 and 5 are each covered by two intervals; 5 lies in both [2,5] and [5,7] because both are closed. No point is covered by three.

Constraints

  • 1 <= len(intervals) <= 2 * 10^5
  • -10^9 <= intervals[i][0] <= intervals[i][1] <= 10^9
Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.
Import a question