Maximum Depth of Binary Tree - LeetCode 104 - JavaScript

preview_player
Показать описание


Step by step walk through of the solution to the popular Google coding interview question, Maximum Depth of Binary Tree.

LeetCode 104

JavaScript

0:00 Intro
0:57 Explanation 1
3:19 Code 1
3:58 Explanation 2
6:32 Code 2

#softwareengineering #javascript #leetcode
Комментарии
Автор

Can't we do a DFS traversal and each recursive call, we pass a 'depth' variable and just keep track of the max value of the 'depth' variable?

brianspinos
Автор

This is not clear to me, what is the root.left and the root.right properties

I’ve read this commented code, but i still dont get it.

Also, the input value is not clear as well.
We have nested structure, but somehow we store it like a flat list.

Could someone help me here to get it?

MakIvaNik