题目: 题解: 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
题目描述 最简单直接的解法 遍历 headA 的所有节点, 看 headB 中是否有相交的节点 /*** Definition for singly-linked list.* public class ListNode {* public var val: Int* public var next: ListNode?* public init(_ val: I