mirror of
https://github.com/CyC2018/CS-Notes.git
synced 2025-07-09 20:32:12 +08:00
234回文链表处的一个注解修改
不确定我的理解是不是对的(-o-)
This commit is contained in:
@ -4243,7 +4243,7 @@ public boolean isPalindrome(ListNode head) {
|
|||||||
slow = slow.next;
|
slow = slow.next;
|
||||||
fast = fast.next.next;
|
fast = fast.next.next;
|
||||||
}
|
}
|
||||||
if (fast != null) slow = slow.next; // 偶数节点,让 slow 指向下一个节点
|
if (fast != null) slow = slow.next; // 链表节点个数为奇数,让 slow 指向下一个节点
|
||||||
cut(head, slow); // 切成两个链表
|
cut(head, slow); // 切成两个链表
|
||||||
return isEqual(head, reverse(slow));
|
return isEqual(head, reverse(slow));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user