public class Solution {
public int maxDepth(TreeNode root) {
if(root ==
null) {
return
0;
}
else {
int left = maxDepth(root.
left)+
1;
int right = maxDepth(root.
right)+
1;
return
left>
right?
left:
right;
}
}
}
转载请注明原文地址: https://ju.6miu.com/read-25977.html