Добавить
Уведомления

Maximum Depth of Binary Tree | Facebook, Amazon, Linkedin interview question | Leetcode 104

Time: O(N) Space: O(h) (height of the tree) Also check if the below code makes it easier for you to understand... level +=1;  int left=maxDepth(root.left); int right=maxDepth(root.right); return Math.max(left,right)

Иконка канала JavaScript и алгоритмы
10 подписчиков
12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

Time: O(N) Space: O(h) (height of the tree) Also check if the below code makes it easier for you to understand... level +=1;  int left=maxDepth(root.left); int right=maxDepth(root.right); return Math.max(left,right)

, чтобы оставлять комментарии