Skip to content

Commit 3579948

Browse files
authored
feat: update lc problems (#5173)
1 parent 2897af4 commit 3579948

22 files changed

Lines changed: 87 additions & 57 deletions

File tree

solution/2600-2699/2615.Sum of Distances/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ tags:
3232
<strong>输入:</strong>nums = [1,3,1,1,2]
3333
<strong>输出:</strong>[5,0,3,4,0]
3434
<strong>解释:</strong>
35-
i = 0 ,nums[0] == nums[2] 且 nums[0] == nums[3] 。因此,arr[0] = |0 - 2| + |0 - 3| = 5 。
35+
i = 0 ,nums[0] == nums[2] 且 nums[0] == nums[3] 。因此,arr[0] = |0 - 2| + |0 - 3| = 5 。
3636
i = 1 ,arr[1] = 0 因为不存在值等于 3 的其他下标。
3737
i = 2 ,nums[2] == nums[0] 且 nums[2] == nums[3] 。因此,arr[2] = |2 - 0| + |2 - 3| = 3 。
38-
i = 3 ,nums[3] == nums[0] 且 nums[3] == nums[2] 。因此,arr[3] = |3 - 0| + |3 - 2| = 4 。
38+
i = 3 ,nums[3] == nums[0] 且 nums[3] == nums[2] 。因此,arr[3] = |3 - 0| + |3 - 2| = 4 。
3939
i = 4 ,arr[4] = 0 因为不存在值等于 2 的其他下标。
4040
</pre>
4141

@@ -213,7 +213,7 @@ function distance(nums: number[]): number[] {
213213
}
214214
}
215215
return ans;
216-
};
216+
}
217217
```
218218

219219
#### Rust

solution/2600-2699/2615.Sum of Distances/README_EN.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ tags:
3030
<pre>
3131
<strong>Input:</strong> nums = [1,3,1,1,2]
3232
<strong>Output:</strong> [5,0,3,4,0]
33-
<strong>Explanation:</strong>
34-
When i = 0, nums[0] == nums[2] and nums[0] == nums[3]. Therefore, arr[0] = |0 - 2| + |0 - 3| = 5.
33+
<strong>Explanation:</strong>
34+
When i = 0, nums[0] == nums[2] and nums[0] == nums[3]. Therefore, arr[0] = |0 - 2| + |0 - 3| = 5.
3535
When i = 1, arr[1] = 0 because there is no other index with value 3.
36-
When i = 2, nums[2] == nums[0] and nums[2] == nums[3]. Therefore, arr[2] = |2 - 0| + |2 - 3| = 3.
37-
When i = 3, nums[3] == nums[0] and nums[3] == nums[2]. Therefore, arr[3] = |3 - 0| + |3 - 2| = 4.
38-
When i = 4, arr[4] = 0 because there is no other index with value 2.
36+
When i = 2, nums[2] == nums[0] and nums[2] == nums[3]. Therefore, arr[2] = |2 - 0| + |2 - 3| = 3.
37+
When i = 3, nums[3] == nums[0] and nums[3] == nums[2]. Therefore, arr[3] = |3 - 0| + |3 - 2| = 4.
38+
When i = 4, arr[4] = 0 because there is no other index with value 2.
3939

4040
</pre>
4141

@@ -215,7 +215,7 @@ function distance(nums: number[]): number[] {
215215
}
216216
}
217217
return ans;
218-
};
218+
}
219219
```
220220

221221
#### Rust

solution/2600-2699/2615.Sum of Distances/Solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ function distance(nums: number[]): number[] {
2424
}
2525
}
2626
return ans;
27-
};
27+
}

solution/3200-3299/3213.Construct String with Minimum Cost/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ class Hashing {
371371
}
372372

373373
public query(l: number, r: number): number {
374-
const res = (this.h[r] - this.h[l - 1] * this.p[r - l + 1] % this.mod + this.mod) % this.mod;
374+
const res =
375+
(this.h[r] - ((this.h[l - 1] * this.p[r - l + 1]) % this.mod) + this.mod) % this.mod;
375376
return Number(res);
376377
}
377378
}

solution/3200-3299/3213.Construct String with Minimum Cost/README_EN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ class Hashing {
371371
}
372372

373373
public query(l: number, r: number): number {
374-
const res = (this.h[r] - this.h[l - 1] * this.p[r - l + 1] % this.mod + this.mod) % this.mod;
374+
const res =
375+
(this.h[r] - ((this.h[l - 1] * this.p[r - l + 1]) % this.mod) + this.mod) % this.mod;
375376
return Number(res);
376377
}
377378
}

solution/3200-3299/3213.Construct String with Minimum Cost/Solution.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class Hashing {
1818
}
1919

2020
public query(l: number, r: number): number {
21-
const res = (this.h[r] - this.h[l - 1] * this.p[r - l + 1] % this.mod + this.mod) % this.mod;
21+
const res =
22+
(this.h[r] - ((this.h[l - 1] * this.p[r - l + 1]) % this.mod) + this.mod) % this.mod;
2223
return Number(res);
2324
}
2425
}

solution/3900-3999/3901.Good Subsequence Queries/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ source: 第 497 场周赛 Q4
3030

3131
<p>在每次查询更新后,判断当前数组中是否存在<strong>&nbsp;任意一个好子序列</strong>。</p>
3232

33-
<p>返回一个整数,表示在多少次查询之后,数组中存在&nbsp;<strong>好子序列</strong>。</p>
33+
<p>返回一个整数,表示使得数组中存在&nbsp;<strong>好子序列</strong>&nbsp;的查询&nbsp;<strong>次数</strong>。</p>
3434

3535
<p><strong>子序列</strong>&nbsp;是指通过删除原序列中的某些元素或不删除任何元素,并且不改变剩余元素相对顺序后得到的序列。</p>
3636

solution/3900-3999/3902.Zigzag Level Sum of Binary Tree/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
comments: true
33
difficulty: 中等
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3900-3999/3902.Zigzag%20Level%20Sum%20of%20Binary%20Tree/README.md
5+
tags:
6+
-
7+
- 广度优先搜索
8+
- 二叉树
59
---
610

711
<!-- problem:start -->

solution/3900-3999/3902.Zigzag Level Sum of Binary Tree/README_EN.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
comments: true
33
difficulty: Medium
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3900-3999/3902.Zigzag%20Level%20Sum%20of%20Binary%20Tree/README_EN.md
5+
tags:
6+
- Tree
7+
- Breadth-First Search
8+
- Binary Tree
59
---
610

711
<!-- problem:start -->

solution/3900-3999/3903.Smallest Stable Index I/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: 简单
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3900-3999/3903.Smallest%20Stable%20Index%20I/README.md
5+
tags:
6+
- 数组
57
---
68

79
<!-- problem:start -->

0 commit comments

Comments
 (0)