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. 递归求解
2. Level Order Traversal
3. 特别注意,左子树为空,需要计算右子树的最小高度。
4. 特别注意,右子树为空,需要计算左子树的最小高度。
3. 特别注意,左子树为空,需要计算右子树的最小高度。
4. 特别注意,右子树为空,需要计算左子树的最小高度。
No comments:
Post a Comment