We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b594b1a commit d4a3fd0Copy full SHA for d4a3fd0
src/com/blankj/custom/structure/ListNode.java
@@ -18,9 +18,8 @@ public ListNode(int val, ListNode next) {
18
public ListNode reverseList(ListNode head) {
19
ListNode curr = null;
20
while (head != null) { //如果当前节点不为空
21
- ListNode tmp = head.next; //tmp赋值为head后面的节点
22
curr = head; //prev后移一位
23
- head = tmp; //head后移一位
+ head = head.next; //head后移一位
24
head.next = curr; //head指向head后面那个
25
}
26
return curr;
0 commit comments