/*function ListNode(x){
this.val = x;
this.next = null;
}*/
function FindFirstCommonNode(pHead1, pHead2)
{
// write code here
let temp = pHead2;
while(pHead1){
while(pHead2){
if(pHead1 === pHead2){
return pHead1
}
pHead2 = pHead2.next;
}
pHead1 = pHead1.next;
pHead2 = temp
}
}
module.exports = {
FindFirstCommonNode : FindFirstCommonNode
}; 


京公网安备 11010502036488号