【代码随想录Day15】二叉树 Part.4
# 找树左下角的值 题目链接🔗 # 迭代 层序遍历找最后一行第一个值。 class Solution {public: int findBottomLeftValue(TreeNode* root) { queue<TreeNode*> que; if (root != nullptr) que.push(root); int result = 0; while (!que.empty()) { int size = que.size(); for (int i = 0; i < size; i++)...
more...