Skip to content

Commit 0e3d3a6

Browse files
authored
Create 513. Find Bottom Left Tree Value (#419)
2 parents 6a8d068 + 4848068 commit 0e3d3a6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

513. Find Bottom Left Tree Value

+21
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)