Maximum Depth of Binary Tree

very easy recursion

1 public class Solution {
2     public int maxDepth(TreeNode root) {
3         // IMPORTANT: Please reset any member data you declared, as
4         // the same Solution instance will be reused for each test case.
5         if(root == null)
6             return 0;
7         return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
8     }
9 }
原文地址:https://www.cnblogs.com/jasonC/p/3404909.html