LeetCode solutions

2005. Check if All the Integers in a Range Are Covered

My accepted Python solution to LeetCode problem 2005, Check if All the Integers in a Range Are Covered, running in 0ms.

  • Difficulty: Easy
  • Python
  • Runtime 0ms
  • Memory 17.3MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.3MB, accepted 2025-12-30.

python
class Solution:
    def isCovered(self, ranges: List[List[int]], left: int, right: int) -> bool:
        for num in range(left, right + 1):
            covered = False
            for start, end in ranges:
                if start <= num <= end:
                    covered = True
                    break
            if not covered:
                return False
        return True

Source