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 5c009e6 commit 9cbb1ebCopy full SHA for 9cbb1eb
maximum-depth-of-binary-tree/sora0319.java
@@ -0,0 +1,9 @@
1
+class Solution {
2
+ public int maxDepth(TreeNode root) {
3
+ if(root == null){
4
+ return 0;
5
+ }
6
+
7
+ return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
8
9
+}
0 commit comments