Code Room
CodingEasycod-g1466
Subject IntervalsLevel Entry–Mid~12 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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) → bool
Examples
in[[[0,8],[6,16],[16,24]],0,24]outtrue
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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.