Problem 104: Maximum Depth of Binary Tree
思路
Binary Tree的问题首先想到的就是“分治-递归”
“分治-递归”要想好的一点就是考虑好return条件
复杂度
对于 recursion 遍历类型的复杂度的分析,要明白一点,他的复杂度是要遍历整个树,所以是
O(n)
PreviousProblem: Convert Binary Search Tree to Doubly Linked List (LintCode)NextProblem 111: Minimum Depth of Binary Tree
Last updated