Skip to content

Commit 865f078

Browse files
authored
feat: add solutions to lc problem: No.3313 (doocs#3623)
No.3313.Find the Last Marked Nodes in Tree
1 parent a1ce685 commit 865f078

File tree

20 files changed

+916
-237
lines changed

20 files changed

+916
-237
lines changed

lcof2/剑指 Offer II 101. 分割等和子串/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ class Solution {
166166
let target = s / 2
167167
var dp = Array(repeating: false, count: target + 1)
168168
dp[0] = true
169-
169+
170170
for num in nums {
171171
for j in stride(from: target, through: num, by: -1) {
172172
dp[j] = dp[j] || dp[j - num]
173173
}
174174
}
175-
175+
176176
return dp[target]
177177
}
178178
}

lcof2/剑指 Offer II 102. 加减的目标值/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,13 @@ class Solution {
171171
if target < -1000 || target > 1000 {
172172
return 0
173173
}
174-
174+
175175
let n = nums.count
176176
var dp = Array(repeating: Array(repeating: 0, count: 2001), count: n)
177-
177+
178178
dp[0][nums[0] + 1000] += 1
179179
dp[0][-nums[0] + 1000] += 1
180-
180+
181181
for i in 1..<n {
182182
for j in -1000...1000 {
183183
if dp[i - 1][j + 1000] > 0 {
@@ -186,7 +186,7 @@ class Solution {
186186
}
187187
}
188188
}
189-
189+
190190
return dp[n - 1][target + 1000]
191191
}
192192
}

lcof2/剑指 Offer II 105. 岛屿的最大面积/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class Solution {
281281
var area = 1
282282
grid[i][j] = 0
283283
let dirs = [-1, 0, 1, 0, -1]
284-
284+
285285
for k in 0..<4 {
286286
let x = i + dirs[k], y = j + dirs[k + 1]
287287
if x >= 0 && x < m && y >= 0 && y < n {

solution/1400-1499/1436.Destination City/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ tags:
3030

3131
<pre>
3232
<strong>输入:</strong>paths = [["London","New York"],["New York","Lima"],["Lima","Sao Paulo"]]
33-
<strong>输出:</strong>"Sao Paulo"
33+
<strong>输出:</strong>"Sao Paulo"
3434
<strong>解释:</strong>从 "London" 出发,最后抵达终点站 "Sao Paulo" 。本次旅行的路线是 "London" -&gt; "New York" -&gt; "Lima" -&gt; "Sao Paulo" 。
3535
</pre>
3636

solution/1400-1499/1436.Destination City/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ tags:
2929

3030
<pre>
3131
<strong>Input:</strong> paths = [[&quot;London&quot;,&quot;New York&quot;],[&quot;New York&quot;,&quot;Lima&quot;],[&quot;Lima&quot;,&quot;Sao Paulo&quot;]]
32-
<strong>Output:</strong> &quot;Sao Paulo&quot;
32+
<strong>Output:</strong> &quot;Sao Paulo&quot;
3333
<strong>Explanation:</strong> Starting at &quot;London&quot; city you will reach &quot;Sao Paulo&quot; city which is the destination city. Your trip consist of: &quot;London&quot; -&gt; &quot;New York&quot; -&gt; &quot;Lima&quot; -&gt; &quot;Sao Paulo&quot;.
3434
</pre>
3535

solution/2100-2199/2161.Partition Array According to Given Pivot/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ tags:
4040
<pre>
4141
<strong>Input:</strong> nums = [9,12,5,10,14,3,10], pivot = 10
4242
<strong>Output:</strong> [9,5,3,10,10,12,14]
43-
<strong>Explanation:</strong>
43+
<strong>Explanation:</strong>
4444
The elements 9, 5, and 3 are less than the pivot so they are on the left side of the array.
4545
The elements 12 and 14 are greater than the pivot so they are on the right side of the array.
4646
The relative ordering of the elements less than and greater than pivot is also maintained. [9, 5, 3] and [12, 14] are the respective orderings.
@@ -51,7 +51,7 @@ The relative ordering of the elements less than and greater than pivot is also m
5151
<pre>
5252
<strong>Input:</strong> nums = [-3,4,3,2], pivot = 2
5353
<strong>Output:</strong> [-3,2,4,3]
54-
<strong>Explanation:</strong>
54+
<strong>Explanation:</strong>
5555
The element -3 is less than the pivot so it is on the left side of the array.
5656
The elements 4 and 3 are greater than the pivot so they are on the right side of the array.
5757
The relative ordering of the elements less than and greater than pivot is also maintained. [-3] and [4, 3] are the respective orderings.

solution/3100-3199/3171.Find Subarray With Bitwise AND Closest to K/README.md

-114
This file was deleted.

solution/3100-3199/3171.Find Subarray With Bitwise AND Closest to K/README_EN.md

-112
This file was deleted.

0 commit comments

Comments
 (0)