方法一
思路:DFS
时间复杂度:O(n)
1 | // Runtime: 80 ms, faster than 17.32% of JavaScript online submissions for Minimum Depth of Binary Tree. |
方法二
思路:BFS
时间复杂度:O(n)
1 | // Runtime: 72 ms, faster than 21.72% of JavaScript online submissions for Minimum Depth of Binary Tree. |
test cases
1 | test("test1", () => { |