//leetcode submit region begin(Prohibit modification and deletion)
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode() {}
* TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) {
* this.val = val;
* this.left = left;
* this.right = right;
* }
* }
*/
class Solution {
public int maxDepth(TreeNode root) {
if(root == null){
return 0;
}

int leftMaxDepth = maxDepth(root.left);
int rightMaxDepth = maxDepth(root.right);
int res = Math.max(leftMaxDepth, rightMaxDepth)+1;
return res;
}
}
//leetcode submit region end(Prohibit modification and deletion)

不恋尘世浮华,不写红尘纷扰