Facebook | Phone Screen | Point in max overlapping intervals
Anonymous User
18891

Given number M and N intervals in the form [a, b] (inclusive) where for every interval -M <= a <= b <= M, create a program that returns a point where the maximum number of intervals overlap.

Example:

  • M: 10
  • N: 4
  • Intervals:
    • [-3, 5]
    • [0, 2]
    • [8, 10]
    • [6, 7]

A correct answer would be either 0 ,1 or 2 since those points are found where 2 intervals overlap and 2 is the maximum number of overlapping intervals.

Comments (20)