Missing test case in java

  • 0

    I find the solution of "without knowing the difference in length" is very smart!!!
    a, b = headA, headB
    while a != b:
    a = a.next if a else headB
    b = b.next if b else headA
    return a
    Then I try it by using Python and Java. In Python, there is a no intersection test case I cannot pass:

    a = [1,3,5,7,9]
    b = [2,4,6,8,10]

    But I pass all test case by using this method in Java. Which means Java test cases don't have this corner case.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.