problemscpp
A collection of my answers to algorithm problems in c++.
acwing
acwing36
Solution
静态 Public 成员函数
|
所有成员列表
acwing::acwing36::Solution类 参考
#include <
acwing.h
>
静态 Public 成员函数
static
ListNode
*
merge
(
ListNode
*l1,
ListNode
*l2)
详细描述
在文件
acwing.h
第
1629
行定义.
成员函数说明
◆
merge()
ListNode
* acwing::acwing36::Solution::merge
(
ListNode
*
l1
,
ListNode
*
l2
)
static
在文件
acwing.cpp
第
5067
行定义.
5067
{
5068
auto
*current =
new
ListNode(0);
5069
const
ListNode *head = current;
5070
while
(l1 !=
nullptr
&& l2 !=
nullptr
) {
5071
if
(l1->val < l2->val) {
5072
current->next = l1;
5073
l1 = l1->next;
5074
}
else
{
5075
current->next = l2;
5076
l2 = l2->next;
5077
}
5078
current = current->next;
5079
}
5080
if
(l1 ==
nullptr
) {
5081
current->next = l2;
5082
}
else
{
5083
current->next = l1;
5084
}
5085
return
head->next;
5086
}
该类的文档由以下文件生成:
acwing.h
acwing.cpp
制作者
1.9.2