解法一HashSet查重完整代码public ListNode GetIntersectionNode(ListNode headA, ListNode headB) { HashSetListNode nodes new HashSetListNode(); ListNode ptr null; for (ptr headA; ptr ! null; ptr ptr.next) { nodes.Add(ptr); } for (ptr headB; ptr ! null; ptr ptr.next) { if (!nodes.Add(ptr)) return ptr; } return null; }提交记录