104. Maximum Depth of Binary Tree (Tree)
easy
1 class Solution { 2 public int maxDepth(TreeNode root) { 3 if(root != null) { 4 int left = maxDepth(root.left); 5 int right = maxDepth(root.right); 6 return Math.max(left, right) + 1; 7 8 }else { 9 return 0; 10 } 11 12 } 13 }