题目链接
https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
题解
- 递归
- 递归出口是当前结点为空,则返回0
- 如果非空,则该结点深度为左子树和右子树深度的最大值+1
1 | // Problem: LeetCode 104 |
作者:@臭咸鱼
转载请注明出处:https://www.cnblogs.com/chouxianyu/
欢迎讨论和交流!
快给我氧气!
https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
1 | // Problem: LeetCode 104 |
作者:@臭咸鱼
转载请注明出处:https://www.cnblogs.com/chouxianyu/
欢迎讨论和交流!