We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1b01a73 commit 6127e05Copy full SHA for 6127e05
허현빈/9주차/Maximum Depth of Binary Tree.js
@@ -0,0 +1,8 @@
1
+/**
2
+ * @param {TreeNode} root
3
+ * @return {number}
4
+ */
5
+var maxDepth = function (root) {
6
+ if (!root) return 0;
7
+ return 1 + Math.max(maxDepth(root.left), maxDepth(root.right));
8
+};
0 commit comments