Interval containment check
Your task
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].
Examples
has_contained_interval(intervals: list[list[int]]) -> boolExample 1
Input
has_contained_interval([[1, 6], [2, 4], [7, 9]])Output
True