Open jzhangnu opened 6 years ago
var findBottomLeftValue = function(root) { var result = root.val; var resultHeight = 0; (function recurse (node, height) { if (node === null) { return; } if (node.left !== null) { recurse(node.left, height + 1); } if (height > resultHeight) { result = node.val; resultHeight = height; } if (node.right !== null) { recurse(node.right, height + 1); } })(root, 1); return result; };