Skip to content

Commit f6ff982

Browse files
committed
24-swap-nodes-in-pairs.md Added 7 languages' solutions.
1 parent f239622 commit f6ff982

4 files changed

Lines changed: 467 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ You can skip the more difficult problems and do them later.
2525
- [203. Remove Linked List Elements](solutions/1-1000/203-remove-linked-list-elements.md) was solved in _Python, Java, C++, JavaScript, C#, Go, Ruby_.
2626
- [206. Reverse Linked List](solutions/1-1000/206-reverse-linked-list.md) was solved in _Python, Java, C++, JavaScript, C#, Go, Ruby_.
2727
- [707. Design Linked List](solutions/1-1000/707-design-linked-list.md) was solved in _Python, Java, JavaScript, C#_.
28+
- [24. Swap Nodes in Pairs](solutions/1-1000/24-swap-nodes-in-pairs.md) was solved in _Python, Java, C++, JavaScript, C#, Go, Ruby_.
2829

2930
# Dynamic Programming
3031
## Basics

images/examples/24_1.jpg

15.3 KB
Loading

solutions/1-1000/206-reverse-linked-list.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Given the `head` of a singly linked list, reverse the list, and return _the reve
3535

3636
1. To solve this problem, we only need to define **two** variables: `current` and `previous`.
3737
2. `current.next = previous` is the inversion.
38-
3. The loop condition should be `while current != null` instead of `while current.next != null`, because the operation to be performed is `current.next = previous`.
38+
3. The loop condition should be `while (current != null)` instead of `while (current.next != null)`, because the operation to be performed is `current.next = previous`.
3939

4040
## Steps to the Solution
4141
1. Traverse all nodes.
@@ -299,7 +299,7 @@ end
299299
### 思路
300300
1. 解决这个问题,只需要定义****个变量:`current``previous`
301301
2. `current.next = previous`就是反转了。
302-
3. 循环条件应是`while current != null`,而不应该是`while current.next != null`,因为需要操作的是`current.next = previous`.
302+
3. 循环条件应是`while (current != null)`,而不应该是`while (current.next != null)`,因为需要操作的是`current.next = previous`.
303303

304304
### 步骤
305305
1. 遍历所有节点。

0 commit comments

Comments
 (0)