Skip to content

Commit 36aed9e

Browse files
authored
Merge pull request gzc426#388 from u-hechongyang/master
5
2 parents 299ae2a + f578023 commit 36aed9e

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)