LeetCode: Maximum Depth of Binary Tree Solution
Explanation is hardImplementation
1var maxDepth = function (root) {2 if (!root) return 034 return Math.max(maxDepth(root.left), maxDepth(root.right)) + 15}
References
Similar problems
Minimum Depth of Binary Tree
Maximum Depth of N-ary Tree
Time Needed to Inform All Employees
Amount of Time for Binary Tree to Be Infected
Comments
Loading comments...
Tags
leetcode
tree
binary tree
recursion
Apply and earn a $2,500 bonus once you're hired on your first job!
Clients from the Fortune 500 to Silicon Valley startups
Choose your own rate, get paid on time
From hourly, part-time, to full-time positions
Flexible remote working environment
A lot of open JavaScript jobs!!
Fact corner: Referred talent are 5x more likely to pass the Toptal screening process than the average applicant.
Still hesitate? Read HoningJS author's guide on dealing with Toptal interview process.