var getIntersectionNode = function(headA, headB) {
if(!headA || !headB) return null;
let a = headA;
let b = headB;
while(a!=b){
a = a? a.next:headB;
b = b? b.next:headA;
}
return a;
};
var getIntersectionNode = function(headA, headB) {
if(!headA || !headB) return null;
let a = headA;
let b = headB;
while(a!=b){
a = a? a.next:headB;
b = b? b.next:headA;
}
return a;
};
本文标题:链表交点
本文链接:https://www.haomeiwen.com/subject/lqnthktx.html
网友评论