We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db34023 commit fd56326Copy full SHA for fd56326
maximum-depth-of-binary-tree/sooooo-an.ts
@@ -0,0 +1,6 @@
1
+function maxDepth(root: TreeNode | null): number {
2
+ if (!root) return 0;
3
+ const left = maxDepth(root.left);
4
+ const right = maxDepth(root.right);
5
+ return Math.max(left, right) + 1;
6
+}
0 commit comments