Skip to content

Commit f9b989b

Browse files
committed
fix: update
1 parent abf4049 commit f9b989b

File tree

1 file changed

+1
-1
lines changed
  • solution/1800-1899/1893.Check if All the Integers in a Range Are Covered

1 file changed

+1
-1
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
@@ -67,7 +67,7 @@ tags:
6767

6868
我们可以使用差分数组的思想,创建一个长度为 $52$ 的差分数组 $\textit{diff}$。
6969

70-
接下来,我们遍历数组 $\textit{ranges}$,对于每个区间 $[l, r]$,我们令 $\textit{diff}[l]$ 自增 $1$,$\textit{diff}[r + 1]$ 自减 $1$。
70+
接下来,我们遍历数组 $\textit{ranges}$,对于每个区间 $[l, r]$,我们令 $\textit{diff}[l]$ 自增 $1$,$\textit{diff}[r + 1]$ 自减 $1$。
7171

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

0 commit comments

Comments
 (0)