Skip to content

Commit 5efba6f

Browse files
committed
chore: update
1 parent c591169 commit 5efba6f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

solution/2500-2599/2598.Smallest Missing Non-negative Integer After Operations/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ nums 的 MEX 是 2 。可以证明 2 是可以取到的最大 MEX 。
7676

7777
### 方法一:计数
7878

79-
我们用哈希表或数组 $cnt$ 统计数组中每个数对 $value$ 取模后的余数的个数。
79+
我们用哈希表 $\textit{cnt}$ 统计数组中每个数对 $\textit{value}$ 取模后的余数的个数。
8080

81-
然后从 $0$ 开始遍历,对于当前遍历到的数 $i$,如果 $cnt[i \bmod value]$ 为 $0$,说明数组中不存在一个数对 $value$ 取模后的余数为 $i$,那么 $i$ 就是数组的 MEX,直接返回即可。否则,将 $cnt[i \bmod value]$ 减 $1$,继续遍历。
81+
然后从 $0$ 开始遍历,对于当前遍历到的数 $i$,如果 $\textit{cnt}[i \bmod \textit{value}]$ 为 $0$,说明数组中不存在一个数对 $\textit{value}$ 取模后的余数为 $i$,那么 $i$ 就是数组的 MEX,直接返回即可。否则,将 $\textit{cnt}[i \bmod \textit{value}]$ 减 $1$,继续遍历。
8282

83-
时间复杂度 $O(n)$,空间复杂度 $O(value)$。其中 $n$ 为数组 $nums$ 的长度。
83+
时间复杂度 $O(n)$,空间复杂度 $O(\textit{value})$。其中 $n$ 为数组 $\textit{nums}$ 的长度。
8484

8585
<!-- tabs:start -->
8686

solution/2500-2599/2598.Smallest Missing Non-negative Integer After Operations/README_EN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ The MEX of nums is 2. It can be shown that 2 is the maximum MEX we can achieve.
7474

7575
<!-- solution:start -->
7676

77-
### Solution 1: Count
77+
### Solution 1: Counting
7878

79-
We use a hash table or array $cnt$ to count the number of times each remainder of $value$ is taken modulo in the array.
79+
We use a hash table $\textit{cnt}$ to count the number of remainders when each number in the array is modulo $\textit{value}$.
8080

81-
Then start from $0$ and traverse, for the current number $i$ traversed, if $cnt[i \bmod value]$ is $0$, it means that there is no number in the array that takes $i$ modulo $value$ as the remainder, then $i$ is the MEX of the array, and return directly. Otherwise, reduce $cnt[i \bmod value]$ by $1$ and continue to traverse.
81+
Then we traverse starting from $0$. For the current number $i$ being traversed, if $\textit{cnt}[i \bmod \textit{value}]$ is $0$, it means there is no number in the array whose remainder when modulo $\textit{value}$ is $i$, so $i$ is the MEX of the array, and we can return it directly. Otherwise, we decrement $\textit{cnt}[i \bmod \textit{value}]$ by $1$ and continue traversing.
8282

83-
The time complexity is $O(n)$ and the space complexity is $O(value)$. Where $n$ is the length of the array $nums$.
83+
The time complexity is $O(n)$ and the space complexity is $O(\textit{value})$, where $n$ is the length of array $\textit{nums}$.
8484

8585
<!-- tabs:start -->
8686

0 commit comments

Comments
 (0)