摘要: 题目:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.解题思路1:设置一个变量存储当前记录下的最小深度,采用先序遍历的方法访问树的每一个节点,设置一个变量表示当前节点所在的层次,如果一个节点没有子节点,那么就比较该节点的深度与当前的最小深度,选择两者之中较小的作为当前的最小深度。代码:/** * Definition for bi 阅读全文