C++ || BFS || 4ms || BEATS 98%  ||BEGINNER FRIENDLY || EASY TO UNDERSTAND
In this,\nWe will just iterate the tree in level order and keep storing the first elements.\nafter the iteration is over, returning the last element of the elem
In this,\nWe will just iterate the tree in level order and keep storing the first elements.\nafter the iteration is over, returning the last element of the elements.\n\nHere\'s the code:\n```\nclass Solution {\npublic:\n    int findBottomLeftValue(TreeNode* root) {\n//         creating a vector to store the first elements of every level\n        int ans;\n        queue<TreeNode*> q;\n        q.push(root);\n        while(!q.empty())\n        {\n            int n=q.size();\n            for(int i=0;i<n;i++)\n            {\n                TreeNode *curr=q.front();\n                q.pop();\n                // pushing every first element \n                if(i==0)   ans=curr->val;\n                if(curr->left)   q.push(curr->left);\n                if(curr->right)  q.push(curr->right);\n            }\n        }\n        // returning the last element of the vector\n        return ans;\n    }\n};\n```
['Breadth-First Search', 'C']