import java.util.*;

public class Solution {
    /**
     * 
     * @param root TreeNode类 
     * @return int整型
     */
    public int maxDepth (TreeNode root) {
        return maxDepthDg(root,0);
    }

    public int maxDepthDg (TreeNode root,int count) {
        if(root==null){
            return count;
        }
        count++;
        return Math.max(maxDepthDg(root.left,count),maxDepthDg(root.right,count));
    }
}