Skip to content

剑指offer52FirstCommonNode #2

Description

@dayAndnight2018

在对两个链表长度判断得到较长或者较短的地方,忽略了两个链表相等的问题,导致测试不通过:
ListNode longListHead = len1 > len2 ? pHead1 : pHead2;
ListNode shortListHead = len1 < len2 ? pHead1 : pHead2;

第二句修改为:
ListNode shortListHead = len1 <= len2 ? pHead1 : pHead2;

问题解决

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions