/** * struct ListNode { * int val; * struct ListNode *next; * }; */ /** * * @param pHead1 ListNode类 * @param pHead2 ListNode类 * @return ListNode类 */ struct ListNode* FindFirstCommonNode(struct ListNode* pHead1, struct ListNode* pHead2 ) { // write code here struct ListNode* cur1 = pHead1, *cur2 = pHead2; while (cur1 != cur2) { cur1 = cur1?cur1->next:pHead2; cur2 = cur2?cur2->next:pHead1; } return cur1; }