public int MiniDepth(TreeNode root){
  if(root == null)
   return 0;
  int left = MiniDepth(root.left);
  int right = MiniDepth(root.right);
if(root.right==null)
return left+1;
if(root.left==null)
return right+1;

return left>right?right+1:left+1;

}

results matching ""

    No results matching ""