RUVIDEO
Поделитесь видео 🙏

Maximum Width of Binary Tree | Leetcode 662 (Java Solution Explained)

Maximum Width of Binary Tree is defined as the max distance between the left most node and the right most not null node of a tree at each level.

problem statement:
https://leetcode.com/problems/maximum-width-of-binary-tree/

can be asked in coding round of amazon coding interview, google coding round, facebook and microsoft tech interview

Given a binary tree, write a function to get the maximum width of the given tree. The maximum width of a tree is the maximum width among all levels.

The width of one level is defined as the length between the end-nodes (the leftmost and right most non-null nodes in the level, where the null nodes between the end-nodes are also counted into the length calculation.

It is guaranteed that the answer will in the range of 32-bit signed integer.

Example 1:

Input:

1
/ \
3 2
/ \ \
5 3 9

Output: 4
Explanation: The maximum width existing in the third level with the length 4 (5,3,null,9).
Example 2:

Input:

1
/
3
/ \
5 3

Output: 2
Explanation: The maximum width existing in the third level with the length 2 (5,3).
Example 3:

Input:

1
/ \
3 2
/
5

Output: 2
Explanation: The maximum width existing in the second level with the length 2 (3,2).
Example 4:

Input:

1
/ \
3 2
/ \
5 9
/ \
6 7
Output: 8
Explanation:The maximum width existing in the fourth level with the length 8 (6,null,null,null,null,null,null,7).


system design: https://www.youtube.com/watch?v=jzPSuBiidF4&list=PLJN9ydlFnJsiEH_U9guHTNs6H2tH00h9S

DS for beginners: https://www.youtube.com/watch?v=cxjWjBPPbzI&list=PLJN9ydlFnJsiGBEhtBTL6Fj_2yxQFhYhS

leetcode solutions: https://www.youtube.com/watch?v=jVN6Mq0mXJo&list=PLJN9ydlFnJsgCQY0_UkzkG2pcds03XR0q

github: https://github.com/TheTechGranth/thegranths
facebook group : https://www.facebook.com/groups/741317603336313/
twitter: https://twitter.com/GranthTech

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Maximum Width of Binary Tree | Leetcode 662 (Java Solution Explained)», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.