/** * Definition for singly-linked list. * function ListNode(val) { * this.val = val; * this.next = null; * } */ /** * @param {ListNode} headA * @param {ListNode} headB * @return {ListNode} */ var getIntersectionNode = function (headA, headB) { let curA = headA let curB = headB while (curA !== curB) { curA = curA === null ? headB : curA.next curB = curB === null ? headA : curB.next } return curA };
原创文章,作者:czhdawn,如若转载,请注明出处:https://www.czhdawn.cn/archives/4906