Skip to content

Commit 4956d63

Browse files
author
lucifer
committed
2 parents 65ca28f + 067e39c commit 4956d63

9 files changed

+26
-4
lines changed

problems/113.path-sum-ii.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Return:
4343

4444
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)
4545

46+
> 图是 [78.subsets](https://github.com/azl397985856/leetcode/blob/master/problems/78.subsets.md),都差不多,仅做参考。
47+
4648
通用写法的具体代码见下方代码区。
4749

4850
## 关键点解析

problems/131.palindrome-partitioning.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Output:
3535

3636
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)
3737

38+
> 图是 [78.subsets](https://github.com/azl397985856/leetcode/blob/master/problems/78.subsets.md),都差不多,仅做参考。
39+
3840

3941
## 关键点解析
4042

problems/25.reverse-nodes-in-k-groups-cn.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,28 @@ class Solution:
157157
count += 1
158158
if count % k == 0:
159159
start = self.reverse(start, end.next)
160+
# end 调到下一个
160161
end = start.next
161162
else:
162163
end = end.next
163164
return dummy.next
165+
# (start, end) 左右都开放
164166

165167
def reverse(self, start, end):
166168
prev, curr = start, start.next
167169
first = curr
170+
# 反转
168171
while curr != end:
169-
temp = curr.next
172+
next = curr.next
170173
curr.next = prev
171174
prev = curr
172-
curr = temp
175+
curr = next
176+
# 将反转后的链表添加到原链表中
173177
start.next = prev
174-
first.next = curr
178+
first.next = end
179+
# 返回反转前的头, 也就是反转后的尾部
175180
return first
181+
176182
```
177183

178184
*javascript code*
@@ -250,4 +256,4 @@ var reverseKGroup = function(head, k) {
250256
3. 翻转步骤#2链表: `1->2->5->4->3->8->7->6`
251257

252258
## 类似题目
253-
- [Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs/)
259+
- [Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs/)

problems/39.combination-sum.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ A solution set is:
4848

4949
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)
5050

51+
> 图是 [78.subsets](https://github.com/azl397985856/leetcode/blob/master/problems/78.subsets.md),都差不多,仅做参考。
52+
5153
通用写法的具体代码见下方代码区。
5254

5355
## 关键点解析

problems/40.combination-sum-ii.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ A solution set is:
4949

5050
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)
5151

52+
> 图是 [78.subsets](https://github.com/azl397985856/leetcode/blob/master/problems/78.subsets.md),都差不多,仅做参考。
53+
5254
通用写法的具体代码见下方代码区。
5355

5456
## 关键点解析

problems/46.permutations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Output:
3939

4040
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)
4141

42+
> 图是 [78.subsets](https://github.com/azl397985856/leetcode/blob/master/problems/78.subsets.md),都差不多,仅做参考。
43+
4244
通用写法的具体代码见下方代码区。
4345

4446
## 关键点解析

problems/47.permutations-ii.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Output:
3636

3737
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)
3838

39+
> 图是 [78.subsets](https://github.com/azl397985856/leetcode/blob/master/problems/78.subsets.md),都差不多,仅做参考。
40+
3941
通用写法的具体代码见下方代码区。
4042

4143
## 关键点解析

problems/78.subsets.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Output:
4444

4545
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)
4646

47+
> 每一层灰色的部分,表示当前有哪些节点是可以选择的, 红色部分则是选择路径。1,2,3,4,5,6 则分别表示我们的 6 个子集。
48+
4749
通用写法的具体代码见下方代码区。
4850

4951
## 关键点解析

problems/90.subsets-ii.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Output:
4141

4242
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)
4343

44+
> 图是 [78.subsets](https://github.com/azl397985856/leetcode/blob/master/problems/78.subsets.md),都差不多,仅做参考。
45+
4446
通用写法的具体代码见下方代码区。
4547

4648
## 关键点解析

0 commit comments

Comments
 (0)