Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
53 lines (45 loc) · 1.05 KB

File metadata and controls

53 lines (45 loc) · 1.05 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
45
46
47
48
49
50
51
52
53
//
// Solution116.hpp
// Algorithm
//
// Created by Pancf on 2020/12/6.
// Copyright © 2020 Pancf. All rights reserved.
//
#ifndef Solution116_hpp
#define Solution116_hpp
#include <stdio.h>
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_val), left(_left), right(_right), next(_next) {}
};
class Solution116 {
public:
Node* connect(Node* root);
static void test()
{
Node root{1};
Node node1{2};
Node node2{3};
Node node3{4};
Node node4{5};
Node node5{6};
Node node6{7};
root.left = &node1;
root.right = &node2;
node1.left = &node3;
node1.right = &node4;
node2.left = &node5;
node2.right = &node6;
Solution116 s;
s.connect(&root);
}
};
#endif /* Solution116_hpp */
Morty Proxy This is a proxified and sanitized view of the page, visit original site.