✅☑Beats 98.29% Users 🔥|| C++ || Easy Solution🔥 || EXPLAINED🔥
Intuition\n Describe your first thoughts on how to solve this problem. \n\n\nLinkedin:https://www.linkedin.com/in/nourhan-essam123/\n\nIf you find it helpful pl
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n![Screenshot (567).png](https://assets.leetcode.com/users/images/8e2dbce3-6259-473c-856d-4c5888b7b415_1709131246.6800537.png)\n\nLinkedin:https://www.linkedin.com/in/nourhan-essam123/\n\nIf you find it helpful please **UPVOTE** \uD83E\uDD17\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n- First let\'s understand what\'s "Bottom Left Tree Node" ?\n\n- Imagine you are standing to the left of the tree, what node at the bottom of the tree can you see?\n\n- Is the "Bottom Left Tree Node" should be from the left of the tree?\n\n- Answering these questions will help you come up with the solution yourself.\n\n- We know that every tree consists of levels and the last level should be the bottom, right?\n\n- So, if we traverse each level of the tree from right to left, will we end up at the "Bottom Left Tree Node"?\n\n- Yes we will \uD83C\uDF89\n\n# Complexity\n- Time complexity:O(n) where n is the number of nodes in the binary tree.\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n) where n is the number of nodes in the binary tree.\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode() : val(0), left(nullptr), right(nullptr) {}\n *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}\n * };\n */\nclass Solution {\npublic:\n    int findBottomLeftValue(TreeNode* root) {\n        queue<TreeNode*>q;\n        q.push(root);\n        int ans = 0;     \n        while(! q.empty()){\n           TreeNode* node = q.front();\n            q.pop(); \n            ans = node->val;\n            if(node->right != nullptr){\n                q.push(node->right);\n            }            \n            if(node->left != nullptr){\n                q.push(node->left);\n            }\n        }\n        return ans;\n    }\n};\n```\n\n![sad-thumbs-up-cat.3.meme.webp](https://assets.leetcode.com/users/images/700bc01b-1255-4d0d-8adb-fd8cf2cc204f_1709131264.4987042.webp)\n
['Tree', 'Breadth-First Search', 'Binary Tree', 'C++']