Simple Recursion || Java || Using Height and Level
Intuition\n Describe your first thoughts on how to solve this problem. \nWe want to find out the left most bottom root value so we just need to focus on the lev
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe want to find out the left most bottom root value so we just need to focus on the level of the trees.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nwe declare height and ans to -1 and as soon as in the solve function when our level get bigger than the height we update our ans variable and we want to find the left most so we call our function recursively first with root.left and then with root.right.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\no(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1) no space required just the stack space is used\n\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    int height;\n    int ans;\n    public int findBottomLeftValue(TreeNode root) {\n        height = -1;\n        ans = -1;\n        solve(root,0);\n        return ans;\n    }\n    void solve(TreeNode root,int level) {\n        if(root == null) return;\n        if(level > height) {\n            height = level;\n            ans = root.val;\n        }\n\n        solve(root.left,level+1);\n        solve(root.right,level+1);\n    }\n}\n```
['Java']