leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0513.cpp (390B)


0 class Solution {
1 public:
2 int findBottomLeftValue(TreeNode *root) {
3 queue<TreeNode *> q({root});
5 int res = -1;
6 while (!q.empty()) {
7 TreeNode *root = q.front();
8 q.pop();
9 res = root->val;
10 if (root->right) q.push(root->right);
11 if (root->left) q.push(root->left);
12 }
14 return res;
15 }
16 };