LeetCode 面试题55

304 阅读1分钟

leetcode-cn.com/problems/er…

class Solution {
    public int maxDepth(TreeNode root) {
        if (root == null) return 0;
        return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
    }
}