Skip to content

Commit 77bffa1

Browse files
committed
maximum depth of binary / 湲곗�
1 parent 1a64a0e commit 77bffa1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function maxDepth(root) {
2+
if (!root) return 0;
3+
4+
return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
5+
}

0 commit comments

Comments
 (0)