Maximum Depth of Binary Tree | Python Recursive DFS Solution

preview_player
Показать описание
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)
Рекомендации по теме
Комментарии
Автор

Thank you for uploading this, I just started LeetCode and DSA in Python, and this is extremely helpful.

PinInBin
visit shbcf.ru