最小路径
二叉树中的最小路径指的是,二叉树中根节点到达叶子节点的路径中,距离最短的一个。
//recursively
public int minDepth1(TreeNode root) {
if (root == null) {
return 0;
} else if (root.left != null && root.right != null) {
return 1+Math.min(minDepth(root.left), minDepth(root.right));
} else {
return 1+Math.max