Maximum Depth of Binary Tree
求二叉树的最大深度,入门级别的递归。
int max(int a, int b){ if(a > b) return a; return b; } int maxDepth(TreeNode *root) { // Start typing your C/C++ solution below // DO NOT write int main() function if(root == NULL) return 0; else return 1+max(maxDepth(root->left), maxDepth(root->right)); }