104. Maximum Depth of Binary Tree (divide & conquer)

time: O(n), visit each node exactly once

space: O(n), call stack worst case is n (depth n)

compare to no. 111

this is postorder

or like this

Last updated

Was this helpful?