struct ListNode* FindFirstCommonNode(struct ListNode* pHead1, struct ListNode* pHead2 ) { // write code here struct ListNode *p=pHead1; struct ListNode *q=pHead2; int len1=0,len2=0; while(p!=NULL){ len1++; p=p->next; } while(q!=NULL){ len2++; q=q->next; } if(len1==len2) p=pHead1,q=pHead2; if(len1>len2){ q=pHead2; p=pHead1; int len=len1-len2; for(int i=0;i<len;i++){ p=p->next; } } if(len1<len2){ q=pHead2; p=pHead1; int len=len2-len1; for(int i=0;i<len;i++){ q=q->next; } } while(q!=p){ p=p->next; q=q->next; } return p; }