题目分析:两个链表如果相交且不存在环,那么这两个链表从相交节点往后的节点都相同,所以,遍历一个链表,在遍历时不断遍历另一个链表,只要相等就可以返回了
struct ListNode *getIntersectionNode(struct ListNode *headA, struct ListNode *headB) {struct ListNode*point1=headA;struct ListNode*point2=headB;if(headA==NULL||headB==NULL){return NULL;}while(point2!=NULL){ point1=headA;while(point1!=NULL){if(point1==point2){return point2;}point1=point1->next;}point2=point2->next;}return NULL;
}