Skip to content

Commit 4848068

Browse files
authored
Create 513. Find Bottom Left Tree Value
1 parent 6a8d068 commit 4848068

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

513. Find Bottom Left Tree Value

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Solution {
2+
public:
3+
int findBottomLeftValue(TreeNode* root) {
4+
queue<TreeNode*>q;
5+
6+
q.push(root);
7+
TreeNode *a=NULL;
8+
while(!q.empty()){
9+
a = q.front();
10+
q.pop();
11+
12+
if(a->right){
13+
q.push(a->right);
14+
}
15+
if(a->left){
16+
q.push(a->left);
17+
}
18+
}
19+
return a->val;
20+
}
21+
};

0 commit comments

Comments
 (0)