Code RoomProbe with most solo coverage
HardPrep Room Coding #4909

Probe with most solo coverage

CodingAlgorithms & data structuresSenior–Staff~35 min

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.

Implement
solo_cover_leader(starts: list[int], ends: list[int]) → int
Examples
in[[0,3],[10,5]]out0
in[[0,5],[6,12]]out1
in[[0,0],[10,10]]out0
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 35 min
InputExpectedGot
[[0,3],[10,5]]0not run yetsample
[[0,5],[6,12]]1not run yetsample
[[0,0],[10,10]]0not run yetsample