Java | BFS | Queue
Perform level order traversal and save the first element encountered of each level.\n\n\npublic int findBottomLeftValue(TreeNode root) {\n        \n        Queu
Perform level order traversal and save the first element encountered of each level.\n\n```\npublic int findBottomLeftValue(TreeNode root) {\n        \n        Queue<TreeNode> q = new LinkedList<>();\n        q.add(root);\n\t\tint res = 0;\n        \n        while (!q.isEmpty()) {\n            \n            int size = q.size();\n            for (int i = 0; i < size; i++) {\n                TreeNode curr = q.poll();\n                \n                if (i == 0) {\n                    res = curr.val;\n                }\n                \n                if (curr.left != null) {\n                    q.add(curr.left);\n                }\n                \n                if (curr.right != null) {\n                    q.add(curr.right);\n                }\n            }\n        }\n        \n        return res;\n    }\n```
['Breadth-First Search', 'Queue', 'Java']