Find the value in
the lower left corner of the tree. This question tells me that I almost forgot the sequence traversal
class Solution {
public:
int findBottomLeftValue(TreeNode* root) {
queue<TreeNode *>que;
int result=0;
if(root!=NULL) que.push(root);
while(!que.empty())
{
int s=que.size();
for(int i=0;i<s;i++)
{
TreeNode *node=que.front();
que.pop();
if(i==0) result=node->val;//直接层序遍历到最下面的左边的第一个
if(node->left) que.push(node->left);
if(node->right) que.push(node->right);
}
}
return result;
}
};