[Java] - Efficient Solution beats 100% java online Solution
\n\nclass Solution {\n    int maxDepth = 0, ans = 0;\n    public int findBottomLeftValue(TreeNode root) {\n        dfs(root, 1);\n        return ans;\n    }\n  
```\n\nclass Solution {\n    int maxDepth = 0, ans = 0;\n    public int findBottomLeftValue(TreeNode root) {\n        dfs(root, 1);\n        return ans;\n    }\n    public void dfs(TreeNode root, int depth) {\n        if(root == null) {\n            return;\n        }\n        if(root.left == null && root.right == null && depth > maxDepth) {\n            ans = root.val;\n            maxDepth = depth;\n        }\n        dfs(root.left, depth+1);\n        dfs(root.right, depth+1);\n        \n    }\n}\n```
['Depth-First Search', 'Java']