problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
acwing::acwing66::Solution类 参考

#include <acwing.h>

静态 Public 成员函数

static ListNodefindFirstCommonNode (ListNode *headA, ListNode *headB)
 

详细描述

在文件 acwing.h1621 行定义.

成员函数说明

◆ findFirstCommonNode()

ListNode * acwing::acwing66::Solution::findFirstCommonNode ( ListNode headA,
ListNode headB 
)
static

在文件 acwing.cpp5052 行定义.

5052 {
5053 unordered_set<ListNode *> nodes;
5054 for(auto *current = headA; current != nullptr; current = current->next) {
5055 nodes.insert(current);
5056 }
5057 for(auto *current = headB; current != nullptr; current = current->next) {
5058 if(nodes.contains(current)) {
5059 return current;
5060 }
5061 }
5062 return nullptr;
5063 }

该类的文档由以下文件生成: