Find Bottom Left Tree Value LeetCode solution in Java
1class Solution {2int max = Integer.MIN_VALUE;3int res = -1;45public int findBottomLeftValue(TreeNode root) {6check(root, 0);7return res;8}910void check(TreeNode root, int h) {11if (root == null) return;12if (h > max) {13max = h;14res = root.val;15}16check(root.left, h + 1);17check(root.right, h + 1);18}19}