方法一
思路:DFS + recursive
时间复杂度:O(n)
1 | // Runtime: 68 ms, faster than 33.83% of JavaScript online submissions for Maximum Depth of Binary Tree. |
方法二
思路:BFS + iterative
时间复杂度:O(n)
1 | // Runtime: 88 ms, faster than 15.71% of JavaScript online submissions for Maximum Depth of Binary Tree. |
test cases
1 | test("test1", () => { |