-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8.6
More file actions
63 lines (55 loc) · 1.55 KB
/
8.6
File metadata and controls
63 lines (55 loc) · 1.55 KB
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
54
55
56
57
58
59
60
61
62
63
//8.6
/*
2025년 8월 6일 세번째 스터디 - 그래프
https://leetcode.com/problems/find-center-of-star-graph/description/?envType=problem-list-v2&envId=graph
https://leetcode.com/problems/binary-tree-inorder-traversal/description/?envType=problem-list-v2&envId=tree
힙
https://leetcode.com/problem-list/heap-priority-queue/
그래프
https://leetcode.com/problem-list/graph/
트리
https://leetcode.com/problem-list/tree/
해시
https://leetcode.com/problem-list/hash-table/
힙 선정문제
https://leetcode.com/problems/last-stone-weight/description/?envType=problem-list-v2&envId=heap-priority-queue
*/
class Solution {
public:
int findCenter(vector<vector<int>>& edges) {
int a = edges[0][0];
int b = edges[0][1];
if(edges[1][0] == a edges[1][1] == a){
return a;
}else if(edges[1][0] == b edges[1][1] == b){
return b;
}
return 0;
}
};
/**
Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode left, TreeNoderight) : val(x), left(left), right(right) {}
};*/
class Solution {
public:
vector<int> nodeList;
void inorder(TreeNode* start){
if(!start){
return;
}
inorder(start->left);
nodeList.push_back(start->val);
inorder(start->right);
}
vector<int> inorderTraversal(TreeNode* root){
inorder(root);
return nodeList;
}
};