C++简洁代码:

class Solution {
public:
    ListNode* FindFirstCommonNode( ListNode* pHead1, ListNode* pHead2) {
        ListNode* hA = pHead1; ListNode* hB = pHead2;
        while(hA != hB) {
            hA = hA == NULL ? pHead1 : hA->next;
            hB = hB == NULL ? pHead2 : hB->next;
        }
        return hA;
    }
};