Created
August 18, 2021 11:23
-
-
Save ahmedfahmy94/98ecffc7397b6f523c39beed91944cd3 to your computer and use it in GitHub Desktop.
Binary Tree Depth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given a binary tree, find its maximum depth. | |
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. | |
Note: A leaf is a node with no children | |
3 | |
/ \ | |
9 20 | |
/ \ | |
15 7 | |
/** | |
* Definition for a binary tree node. | |
* function TreeNode(val) { | |
* this.val = val; | |
* this.left = this.right = null; | |
* } | |
*/ | |
/** | |
* @param {TreeNode} root | |
* @return {number} | |
*/ | |
var maxDepth = function(root) { | |
//implement | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment