Code RoomInterval containment check
EasyPrep Room Coding #670

Interval containment check

CodingAlgorithms & data structuresEntry–Mid~11 min

Given a list of closed integer intervals, return True if some interval completely contains another one at a different index: interval [a, b] contains [c, d] when a <= c and d <= b. Two identical intervals count as containing each other. The list holds at most a few thousand intervals, so a quadratic scan is acceptable. Example: [[1,6],[2,4],[7,9]] is True because [1,6] contains [2,4].

Implement
has_contained_interval(intervals: list[list[int]]) → bool
Examples
in[[[1,6],[2,4],[7,9]]]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.

0:00 of about 11 min
InputExpectedGot
[[[1,6],[2,4],[7,9]]]truenot run yetsample