import java.util.*;

public class Solution {
    // 定义递归函数功能:求出当前结点的
    public int maxDepth (TreeNode root) {
        // 递归终止
        if(root == null) {
            return 0;
        }
        // dfs,先递归左子结点,再递归右子结点,最后求出每一子树的深度的最大值
        return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
    }
}