Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e88f0fa

Browse files
committed
增加No559
1 parent f82635d commit e88f0fa

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

leetcode/Tree/No559.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package Algorithm.leetcode.Tree;
2+
3+
/**
4+
* No559
5+
*
6+
* Created by tujietg on Jan 22, 2020
7+
*/
8+
public class No559 {
9+
public int maxDepth(Node root) {
10+
if (root == null) {
11+
return 0;
12+
}
13+
int end = 0;
14+
for (Node node : root.children) {
15+
int value = maxDepth(node);
16+
17+
if (value > end) {
18+
end = value;
19+
}
20+
}
21+
return end + 1;
22+
}
23+
}

0 commit comments

Comments
 (0)