Maximum Depth of Binary Tree

1 public class Solution {
2     public int maxDepth(TreeNode root) {
3         if(root==null)
4             return 0;
5         return Math.max(maxDepth(root.left),maxDepth(root.right))+1;
6     }
7 }
View Code

 

posted @ 2014-02-06 14:55  krunning  阅读(80)  评论(0编辑  收藏  举报