题解
本题关键:
a+c+b=b+c+a
// 243 h160 相交链表
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
ListNode pointA=headA,pointB=headB;
int rount=2;
while (rount>0){
if (pointA==pointB){
return pointA;
}
pointA=pointA.next;
pointB=pointB.next;
if (pointA==null){
pointA=headB;
rount--;
}
if (pointB==null){
pointB=headA;
}
}
return null;
}