Skip to content

Commit 39bdb61

Browse files
committed
Add Maximun depth of binary tree Solution - s0ooo0k
1 parent 15fb7ac commit 39bdb61

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution {
2+
/*
3+
* 시간복잡도: O(n)
4+
*/
5+
public int maxDepth(TreeNode root) {
6+
if(root==null) return 0;
7+
return 1+Math.max(maxDepth(root.left), maxDepth(root.right));
8+
}
9+
}
10+

0 commit comments

Comments
 (0)