var maxDepth = function(root) {
if(!root)return 0;
return Math.max(maxDepth(root.left),maxDepth(root.right))+1;
};
104
- 本文链接:http://gulinga.github.io/2022/09/21/arithmetic/LeetCode%E7%83%AD%E9%A2%98HOT100/104/
- 版权声明:本博客所有文章除特别声明外,均默认采用 许可协议。
var maxDepth = function(root) {
if(!root)return 0;
return Math.max(maxDepth(root.left),maxDepth(root.right))+1;
};