LeetCode160. 相交链表

class Solution { public: ListNode* getIntersectionNode(ListNode* headA, ListNode* headB) { ListNode* pa = headA; ListNode* pb = headB; while (pa != pb) { pa = pa == NULL ? headB : pa->next; pb = pb == NULL ? headA : pb->next; }return pa; } };

    推荐阅读