两个链表的第一个公共结点(C++)
1.题目描述
输入两个链表,找出它们的第一个公共结点。
2.具体算法
/*
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};*/
class Solution {
public:
ListNode* FindFirstCommonNode( ListNode* pHead1, ListNode* pHead2) {
ListNode*
原创
2020-07-22 01:35:34 ·
458 阅读 ·
0 评论