-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2181.cpp
More file actions
44 lines (41 loc) · 833 Bytes
/
Copy path2181.cpp
File metadata and controls
44 lines (41 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Definition for singly-linked list.
*
*/
struct ListNode
{
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution
{
public:
ListNode *mergeNodes(ListNode *head)
{
if (head == nullptr || head->next == nullptr)
{
return head;
}
if(head->next->)
int temp = head->val;
auto p = mergeNodes(head->next);
head->val =
}
};
int main()
{
//[0,3,1,0,4,5,2,0]
Solution S;
ListNode S1(0);
ListNode S2(2, &S1);
ListNode S3(5, &S2);
ListNode S4(4, &S3);
ListNode S5(0, &S4);
ListNode S6(1, &S5);
ListNode S7(3, &S6);
ListNode S8(0, &S7);
auto p = S.mergeNodes(&S8);
}