* struct TreeNode {
 *	int val;
 *	struct TreeNode *left;
 *	struct TreeNode *right;
 * };
 */

class Solution {
public:
    /**
     * 
     * @param root TreeNode类 
     * @return int整型
     */
    int maxDepth(TreeNode* root) {
        //递归的出口
        if(root==NULL){
            return 0;
        }
        else if(root->left==NULL&&root->right==NULL){
            return 1;
        }
        else{
            return max(maxDepth(root->left), maxDepth(root->right))+1;
            //三目运算符所需时间更长
//             return maxDepth(root->left)>maxDepth(root->right)?
//                 maxDepth(root->left)+1:maxDepth(root->right)+1;
        }
        // write code here
    }
};