Python | Leetcode Python题解之第160题相交链表
题目:
题解:
class Solution:def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:A, B = headA, headBwhile A != B:A = A.next if A else headBB = B.next if B else headAreturn A
题目:
题解:
class Solution:def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:A, B = headA, headBwhile A != B:A = A.next if A else headBB = B.next if B else headAreturn A