Minimum Depth of Binary Tree
issue 3%:Caculate minimum depth of binary tree. Find the shortest path from top-node to bottom-node.
Expected Result 3% : Return the shortest path from top(root) to bottom(leaf).
Conditions 4%: The leaf is defined that a node which doesn't have any childred(left/right).
Logics of Examples 20%:
1.使用 DSF 去追蹤每個 leaf, 最後回傳最小路徑(慢但省 memory)
2.使用 BFS 去追蹤每個 leaf, 最後回傳最小路徑(快但耗 memory)
Issue & Expected Result & ConditionsCaculate minimum depth of binary tree. Find the shortest path from top-node to bottom-node and Return it. The leaf is defined that a node which doesn't have any childred(left/right). Therefore, we will keep tack of each node until getting the shortest path to any leaf.