public int minDepth(TreeNode root){
  if (root == null)   return 0;
  int left=minDepth(root.left);
  int right=minDepth(root.right);
  if (left == 0)   return right + 1;
  if (right == 0)   return left + 1;
  return Math.min(left,right) + 1;
}

public int minDepth ( TreeNode root ) { if ( root == null ) return 0 ; int left = minDepth ( root . left ) ; int right = minDepth ( root . right ) ; if ( left == 0 ) return right + 1 ; if ( right == 0 ) return left + 1 ; return Math . min ( left , right ) + 1 ; }
recursive get mindepth of left and right subtree if one side is 0 , return the other side plus 1 return the smaller one + 1
