Skip to content

Commit ead3083

Browse files
104. Maximum Depth of Binary Tree (java)
1 parent a837521 commit ead3083

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution {
2+
public int maxDepth(TreeNode root) {
3+
if (root == null) return 0;
4+
return Integer.max(maxDepth(root.left), maxDepth(root.right)) + 1;
5+
}
6+
}

0 commit comments

Comments
 (0)