Skip to content

Commit e3f5e9f

Browse files
committed
fix: update
1 parent f9b989b commit e3f5e9f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

solution/1800-1899/1893.Check if All the Integers in a Range Are Covered/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ tags:
7171

7272
接着,我们遍历差分数组 $\textit{diff}$,维护一个前缀和 $s$,对于每个位置 $i$,我们令 $s$ 自增 $\textit{diff}[i]$,如果 $s \le 0$ 且 $left \le i \le right$,则说明区间 $[left, right]$ 中有一个整数 $i$ 没有被覆盖,返回 $\textit{false}$。
7373

74-
如果遍历完差分数组 $\textit{diff}$ 后都没有返回 $\textit{False}$,则说明区间 $[left, right]$ 中的每个整数都被 $\textit{ranges}$ 中至少一个区间覆盖,返回 $\textit{true}$。
74+
如果遍历完差分数组 $\textit{diff}$ 后都没有返回 $\textit{false}$,则说明区间 $[left, right]$ 中的每个整数都被 $\textit{ranges}$ 中至少一个区间覆盖,返回 $\textit{true}$。
7575

7676
时间复杂度 $O(n + M)$,空间复杂度 $O(M)$。其中 $n$ 是数组 $\textit{ranges}$ 的长度,而 $M$ 是区间的最大值,本题中 $M \le 50$。
7777

solution/1800-1899/1893.Check if All the Integers in a Range Are Covered/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Next, we iterate through the array $\textit{ranges}$. For each interval $[l, r]$
6969

7070
Then, we iterate through the difference array $\textit{diff}$, maintaining a prefix sum $s$. For each position $i$, we increment $s$ by $\textit{diff}[i]$. If $s \le 0$ and $left \le i \le right$, it indicates that an integer $i$ within the interval $[left, right]$ is not covered, and we return $\textit{false}$.
7171

72-
If we finish iterating through the difference array $\textit{diff}$ without returning $\textit{False}$, it means that every integer within the interval $[left, right]$ is covered by at least one interval in $\textit{ranges}$, and we return $\textit{true}$.
72+
If we finish iterating through the difference array $\textit{diff}$ without returning $\textit{false}$, it means that every integer within the interval $[left, right]$ is covered by at least one interval in $\textit{ranges}$, and we return $\textit{true}$.
7373

7474
The time complexity is $O(n + M)$, and the space complexity is $O(M)$. Here, $n$ is the length of the array $\textit{ranges}$, and $M$ is the maximum value of the interval, which in this case is $M \le 50$.
7575

0 commit comments

Comments
 (0)