From 826f812bd92315f4c6965747dea34cc0910ec058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=89=E6=80=9D?= <1195056983@qq.com> Date: Tue, 4 Jun 2019 13:13:25 +0800 Subject: [PATCH] =?UTF-8?q?Update=20Leetcode=20=E9=A2=98=E8=A7=A3=20-=20?= =?UTF-8?q?=E9=93=BE=E8=A1=A8.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notes/Leetcode 题解 - 链表.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notes/Leetcode 题解 - 链表.md b/notes/Leetcode 题解 - 链表.md index 8f343f7d..1954a1fc 100644 --- a/notes/Leetcode 题解 - 链表.md +++ b/notes/Leetcode 题解 - 链表.md @@ -42,6 +42,8 @@ public ListNode getIntersectionNode(ListNode headA, ListNode headB) { return l1; } ``` +> 上面的代码默认了链表l1和l2存在交点,在实际的Leetcode代码检测中,是有两个链表没有相交的情况的,所以要先检查是否相交,否则会陷入死循环; +还要判断链表l1和l2是否传入为空值,否则也会出现问题 如果只是判断是否存在交点,那么就是另一个问题,即 [编程之美 3.6]() 的问题。有两种解法: