首页 > 代码库 > Leetcode#104 Maximum Depth of Binary Tree

Leetcode#104 Maximum Depth of Binary Tree

原题地址

 

二叉树的遍历

 

代码:

1 int maxDepth(TreeNode *root) {2         if (!root)3             return 0;4         return max(maxDepth(root->left), maxDepth(root->right)) + 1;5 }

 

Leetcode#104 Maximum Depth of Binary Tree