Java | Simple | Recursive | Beats 100%
\n# Code\n\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     int val;\n *     TreeNode left;\n *     TreeNode right;\n *     TreeN
\n# Code\n```\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     int val;\n *     TreeNode left;\n *     TreeNode right;\n *     TreeNode() {}\n *     TreeNode(int val) { this.val = val; }\n *     TreeNode(int val, TreeNode left, TreeNode right) {\n *         this.val = val;\n *         this.left = left;\n *         this.right = right;\n *     }\n * }\n */\nclass Solution {\n    public int findBottomLeftValue(TreeNode root) {\n        return leftMostValue(root, 0).root.val;\n    }\n\n    class DepthAndValue {\n        int depth;\n        TreeNode root;\n        DepthAndValue() {}\n        DepthAndValue(int depth, TreeNode root) {\n            this.depth = depth;\n            this.root = root;\n        }\n    }\n\n    public DepthAndValue leftMostValue(TreeNode root, int depth){\n        if(root.left == null && root.right == null) {\n            return new DepthAndValue(depth, root);\n        }\n\n        if(root.left == null) {\n            return leftMostValue(root.right, depth + 1);\n        }\n        if(root.right == null) {\n            return leftMostValue(root.left, depth + 1);\n        }\n\n        DepthAndValue leftAns = leftMostValue(root.left, depth + 1);\n        DepthAndValue rightAns = leftMostValue(root.right, depth + 1);\n        if(leftAns.depth < rightAns.depth) return rightAns;\n        else return leftAns;\n    }\n}\n```
['Java']