Maximum Depth of Binary Tree | Python Recursive DFS Solution

Опубликовано: 19 Февраль 2026
на канале: Emily Bao
70
2

Link to Question: https://leetcode.com/problems/maximum...
Time Complexity: O(n) - we visit each node exactly once
Space Complexity: O(log(n)) (but worst case if tree is very unbalanced it could be O(n) if there are only right nodes in the tree)