111.二叉树的最小深度

111.二叉树的最小深度 题解 ​ 当节点为空,则树为一颗空树,深度为0.当左右子节点都为空,则找到了叶子节点,为最终的高度加一。当左右子节点不为空则往下递归,在递归的过程当中高度不断叠加。java class Solution { public int minDepth(TreeNode root) { if(root == null){ retu
相关文章
相关标签/搜索