We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3594467 commit 4014a21Copy full SHA for 4014a21
scripts/algorithms/E/Even Odd Tree/Even Odd Tree.cpp
@@ -1,3 +1,4 @@
1
+// Runtime: 722 ms (Top 5.05%) | Memory: 169.4 MB (Top 18.67%)
2
class Solution {
3
public:
4
bool isEvenOddTree(TreeNode* root) {
@@ -7,10 +8,10 @@ class Solution {
7
8
q.push(root);
9
int j=0;
10
while(q.empty()!=true)
- { vector<int>v;
11
+ { vector<int>v;
12
int n=q.size();
13
for(int i=0;i<n;i++)
- { TreeNode* t=q.front();q.pop();
14
+ { TreeNode* t=q.front();q.pop();
15
v.push_back(t->val);
16
if(t->left) q.push(t->left);
17
if(t->right) q.push(t->right);
@@ -44,4 +45,4 @@ class Solution {
44
45
}
46
return true;
47
-};
48
+};
0 commit comments