题解 | #二叉树的最大深度#
二叉树的最大深度
https://www.nowcoder.com/practice/8a2b2bf6c19b4f23a9bdb9b233eefa73
2022.0806算法第12题二叉树的最大深度
采用递归算法计算,递归左子树和右子树。
if(root==NULL) return 0; return max(maxDepth(root->left),maxDepth(root->right))+1;
二叉树的最大深度
https://www.nowcoder.com/practice/8a2b2bf6c19b4f23a9bdb9b233eefa73
if(root==NULL) return 0; return max(maxDepth(root->left),maxDepth(root->right))+1;
相关推荐
最喜欢秋天的火龙果很...:第一份工作一定要往大的去,工资低点没事。后面换工作会更好找,即使你去小公司,你也不可能不会换工作的。所以找大的去招聘动态