// following solution is identical to the solution of the "Balanced binary tree" var maxDepth = function(root) { if(!root) return 0; function getHeight(node){ if(!node) return 0; let left = getHeight(node.left) let right = getHeight(node.right) return Math.max(left, right) + 1 } return getHeight(root) };
If there are any videos you'd like me to make or if you have any ideas on how to optimize this solution, let me know!
hey could you possibly do some backtrack problems like word search?
Thank you :)
Good idea!
Out of all of the solutions, this one made the most sense to me! Thanks for the vid!
I'm enjoying your whiteboard solutions so much.💖
great videos! your leetcode solutions are very helpful!
// following solution is identical to the solution of the "Balanced binary tree"
var maxDepth = function(root) {
if(!root) return 0;
function getHeight(node){
if(!node) return 0;
let left = getHeight(node.left)
let right = getHeight(node.right)
return Math.max(left, right) + 1
}
return getHeight(root)
};