All problems
Interval Max Overlap Point
Problem
Find the point covered by the most intervals.
intervals is a list of half-open [start, end) ranges. Sweep the endpoints, processing starts before ends at the same coordinate.
Return [point, max_count], choosing the smallest point on ties (and [None, 0] when there are no intervals).
Hint
Sorting starts ahead of ends at the same coordinate handles touching intervals correctly.
Test cases
case 1
in: [[[1,4],[2,5],[3,6]]]
expected: [3,3]
case 2
in: [[[1,2],[2,3]]]
expected: [2,2]
case 3
in: [[]]
expected: [null,0]
case 4
in: [[[5,10],[1,3],[2,4]]]
expected: [2,2]
Starter codePython
def max_overlap(intervals):
# Your code here
pass4 test cases · run your code against them in the editor