aboutsummaryrefslogtreecommitdiff
path: root/n_ary_tree_traverse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'n_ary_tree_traverse.cpp')
-rw-r--r--n_ary_tree_traverse.cpp25
1 files changed, 0 insertions, 25 deletions
diff --git a/n_ary_tree_traverse.cpp b/n_ary_tree_traverse.cpp
deleted file mode 100644
index 9c89682..0000000
--- a/n_ary_tree_traverse.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "leetcode.h"
-
-class Solution {
-public:
- vvd levelOrder(Node *root) {
- vvd ans;
- if (!root)
- return ans;
- queue<Node *> q;
- q.push(root);
- while (!q.empty()) {
- int n = q.size();
- vector<int> v;
- while (n--) {
- auto curr = q.front();
- q.pop();
- v.push_back(curr->val);
- for (auto it : curr->children)
- q.push(it);
- }
- ans.push_back(v);
- }
- return ans;
- }
-};