🔥🔥Easiest Approach | Beats 96.78% 🚀| Must Watch 😎
Intuition: \uD83E\uDD14\nThe code aims to find the leftmost value in the last row of a binary tree. To achieve this, it performs a level order traversal of the 
**Intuition: \uD83E\uDD14**\nThe code aims to find the leftmost value in the last row of a binary tree. To achieve this, it performs a level order traversal of the tree and stores each level\'s values in a vector.\n\n**Approach: \uD83D\uDEE3\uFE0F**\n1. **Level Order Traversal:**\n   - Use a queue to perform level order traversal.\n   - Push each level\'s values into a vector.\n   - Mark the end of each level with a NULL node in the queue.\n\n2. **Extract Leftmost Value:**\n   - After traversal, return the leftmost value of the last level.\n\n**Time Complexity: \u23F0**\n- The code visits each node once during the level order traversal, resulting in a time complexity of O(N), where N is the number of nodes in the tree.\n\n**Space Complexity: \uD83D\uDCBE**\n- The space complexity is O(N), where N is the number of nodes, as it stores the values of all nodes in the vectors.\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    vector<vector<int>> levelOrderTraversal(TreeNode* root)\n    {\n        vector<vector<int>> ans;\n        queue<TreeNode*> q;\n        q.push(root);\n        q.push(NULL);\n        vector<int> level;\n\n        while(!q.empty())\n        {\n            TreeNode* temp = q.front();\n            q.pop();\n\n            if(temp == NULL)\n            {\n                ans.push_back(level);\n                level.clear();\n                if(!q.empty()) q.push(NULL);\n            }\n            else\n            {\n                level.push_back(temp->val);\n\n                if(temp->left) q.push(temp->left);\n                if(temp->right) q.push(temp->right);\n            }\n        }\n        return ans;\n    }\n\n    int findBottomLeftValue(TreeNode* root) {\n        vector<vector<int>> ans = levelOrderTraversal(root);\n\n        return ans[ans.size()-1][0];\n    }\n};\n```\n![lc1.png](https://assets.leetcode.com/users/images/82c66e37-3b4e-44f4-9a39-983f78ff110e_1709094118.1283412.png)\n
['Tree', 'Depth-First Search', 'Breadth-First Search', 'C', 'Binary Tree', 'Python', 'C++', 'Java', 'JavaScript']