真***的菜

class Solution {
public:
ListNode* FindFirstCommonNode( ListNode* pHead1, ListNode* pHead2) {

    struct ListNode* pre = new ListNode(0);
    ListNode* p = pre;
    map<int, int> ret;
    while(pHead1)
    {
        ret[pHead1->val]++;
        pHead1  = pHead1->next;
    }

    while(pHead2)
    {
        ret[pHead2->val]++;
        pHead2  = pHead2->next;
    }

    for(map<int , int>::iterator it=ret.begin();it!=ret.end();it++ )
    {
        if(it->second >= 2)
        {
           struct ListNode* p1 = new ListNode(it->first);;
            p->next = p1;
            p =  p->next;
        }
    }

    return pre->next;
}

};