111. Minimum Depth of Binary Tree
和depth比较像
1 public int minDepth(TreeNode root) { 2 if(root == null) { 3 return 0; 4 } 5 if(root.left == null) { 6 return minDepth(root.right) + 1; 7 } 8 if(root.right == null) { 9 return minDepth(root.left) + 1; 10 } 11 return Math.min(minDepth(root.left), minDepth(root.right)) + 1; 12 }