Skip to content

Commit f578023

Browse files
Merge pull request gzc426#5 from u-hechongyang/u-hechongyang-patch-4
Create 阳.md
2 parents f06d8a0 + 91e9b31 commit f578023

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

2018.12.07-leetcode104/阳.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Definition for a binary tree node.
3+
* public class TreeNode {
4+
* int val;
5+
* TreeNode left;
6+
* TreeNode right;
7+
* TreeNode(int x) { val = x; }
8+
* }
9+
*/
10+
class Solution {
11+
public int maxDepth(TreeNode root) {
12+
if(root == null) {
13+
return 0;
14+
}
15+
return 1 + Math.max(maxDepth(root.left), maxDepth(root.right));
16+
}
17+
}

0 commit comments

Comments
 (0)