Probe with most solo coverage

Write codeHard35 min

Your task

A network operations centre stitches link coverage together from several monitoring probes. Two parallel lists describe them: probe i watches the link from starts[i] up to but not including ends[i]. The probes arrive in no particular order, their windows overlap freely, no probe ends before it starts, and a probe with ends[i] equal to starts[i] watches nothing. A minute is solo for probe i when probe i is the only probe watching it. The centre wants to know which probe would be missed most if it were retired, so return the index of the probe holding the largest number of solo minutes, breaking ties by the smallest index. Every probe is a candidate, including one with no solo minutes at all. Return -1 when there are no probes. The list can run to 100000 probes.

Examples

solo_cover_leader(starts: list[int], ends: list[int]) -> int
Example 1
Inputsolo_cover_leader([0, 3], [10, 5])
Output0
Example 2
Inputsolo_cover_leader([0, 5], [6, 12])
Output1
Example 3
Inputsolo_cover_leader([0, 0], [10, 10])
Output0