Shift coverage verification
An on-call rota lists shifts as [start, end] hour pairs, each occupying the half-open span [start, end); the list is unsorted and shifts may overlap. Return True if every moment from hour from_hour up to hour to_hour is covered by at least one shift. If from_hour equals to_hour there is nothing to cover, so return True. Example: shifts [[0,8],[6,16],[16,24]] cover 0 to 24.
Implement
fully_covered(shifts: list[list[int]], from_hour: int, to_hour: int) → boolExamples
in
[[[0,8],[6,16],[16,24]],0,24]outtrueWhat 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 12 min
solution.py
InputExpectedGot
[[[0,8],[6,16],[16,24]],0,24]truenot run yetsample