Skip to content

Commit 84cd947

Browse files
authored
chore: update lc problems (doocs#3751)
1 parent 841f034 commit 84cd947

File tree

21 files changed

+99
-29
lines changed

21 files changed

+99
-29
lines changed

lcp/LCP 07. 传递信息/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class Solution {
162162
func numWays(_ n: Int, _ relation: [[Int]], _ k: Int) -> Int {
163163
var f = Array(repeating: Array(repeating: 0, count: n), count: k + 1)
164164
f[0][0] = 1
165-
165+
166166
for i in 1...k {
167167
for r in relation {
168168
let a = r[0], b = r[1]
@@ -282,7 +282,7 @@ class Solution {
282282
var f = Array(repeating: 0, count: n)
283283
f[0] = 1
284284
var steps = k
285-
285+
286286
while steps > 0 {
287287
var g = Array(repeating: 0, count: n)
288288
for r in relation {
@@ -292,7 +292,7 @@ class Solution {
292292
f = g
293293
steps -= 1
294294
}
295-
295+
296296
return f[n - 1]
297297
}
298298
}

lcp/LCP 09. 最小跳跃次数/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,24 +189,24 @@ class Solution {
189189
vis[0] = true
190190
var ans = 0
191191
var maxReach = 1
192-
192+
193193
while !queue.isEmpty {
194194
ans += 1
195195
let size = queue.count
196-
196+
197197
for _ in 0..<size {
198198
let i = queue.removeFirst()
199-
199+
200200
let forwardJump = i + jump[i]
201201
if forwardJump >= n {
202202
return ans
203203
}
204-
204+
205205
if !vis[forwardJump] {
206206
queue.append(forwardJump)
207207
vis[forwardJump] = true
208208
}
209-
209+
210210
while maxReach < i {
211211
if !vis[maxReach] {
212212
queue.append(maxReach)
@@ -216,7 +216,7 @@ class Solution {
216216
}
217217
}
218218
}
219-
219+
220220
return -1
221221
}
222222
}

lcp/LCP 10. 二叉树任务调度/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,16 @@ class Solution {
226226
func minimalExecTime(_ root: TreeNode?) -> Double {
227227
return dfs(root)[1]
228228
}
229-
229+
230230
private func dfs(_ root: TreeNode?) -> [Double] {
231231
guard let root = root else { return [0.0, 0.0] }
232-
232+
233233
let left = dfs(root.left)
234234
let right = dfs(root.right)
235-
235+
236236
let sum = left[0] + right[0] + Double(root.val)
237237
let time = max(max(left[1], right[1]), (left[0] + right[0]) / 2) + Double(root.val)
238-
238+
239239
return [sum, time]
240240
}
241241
}

solution/3300-3399/3345.Smallest Divisible Digit Product I/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
comments: true
33
difficulty: 简单
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3345.Smallest%20Divisible%20Digit%20Product%20I/README.md
5+
tags:
6+
- 数学
7+
- 枚举
58
---
69

710
<!-- problem:start -->

solution/3300-3399/3345.Smallest Divisible Digit Product I/README_EN.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
comments: true
33
difficulty: Easy
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3345.Smallest%20Divisible%20Digit%20Product%20I/README_EN.md
5+
tags:
6+
- Math
7+
- Enumeration
58
---
69

710
<!-- problem:start -->

solution/3300-3399/3346.Maximum Frequency of an Element After Performing Operations I/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
comments: true
33
difficulty: 中等
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3346.Maximum%20Frequency%20of%20an%20Element%20After%20Performing%20Operations%20I/README.md
5+
tags:
6+
- 数组
7+
- 二分查找
8+
- 前缀和
9+
- 排序
10+
- 滑动窗口
511
---
612

713
<!-- problem:start -->

solution/3300-3399/3346.Maximum Frequency of an Element After Performing Operations I/README_EN.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
comments: true
33
difficulty: Medium
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3346.Maximum%20Frequency%20of%20an%20Element%20After%20Performing%20Operations%20I/README_EN.md
5+
tags:
6+
- Array
7+
- Binary Search
8+
- Prefix Sum
9+
- Sorting
10+
- Sliding Window
511
---
612

713
<!-- problem:start -->

solution/3300-3399/3347.Maximum Frequency of an Element After Performing Operations II/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
comments: true
33
difficulty: 困难
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3347.Maximum%20Frequency%20of%20an%20Element%20After%20Performing%20Operations%20II/README.md
5+
tags:
6+
- 数组
7+
- 二分查找
8+
- 前缀和
9+
- 排序
10+
- 滑动窗口
511
---
612

713
<!-- problem:start -->

solution/3300-3399/3347.Maximum Frequency of an Element After Performing Operations II/README_EN.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
comments: true
33
difficulty: Hard
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3347.Maximum%20Frequency%20of%20an%20Element%20After%20Performing%20Operations%20II/README_EN.md
5+
tags:
6+
- Array
7+
- Binary Search
8+
- Prefix Sum
9+
- Sorting
10+
- Sliding Window
511
---
612

713
<!-- problem:start -->

solution/3300-3399/3348.Smallest Divisible Digit Product II/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
comments: true
33
difficulty: 困难
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3348.Smallest%20Divisible%20Digit%20Product%20II/README.md
5+
tags:
6+
- 贪心
7+
- 数学
8+
- 字符串
9+
- 回溯
10+
- 数论
511
---
612

713
<!-- problem:start -->

0 commit comments

Comments
 (0)