1、暴力解
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
ListNode* cru;
while(headA!=NULL)
{
cru=headB;
while(cru!=NULL)
{
if(headA==cru) return headA;
cru=cru->next;
}
headA=headA->next;
}
return NULL;
}
};