LeetCode 310. Minimum Height Trees

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

Рекомендации по теме
Комментарии
Автор

Nice explanation! we can also do this by finding the longest path in the graph(diameter) and returning its mid point

dheerajnadakatla
Автор

thank you! I do have a question what does line 20 do? on line 19 we are popping this leaf node from graph and storing it in a temp variable. then on line 20 - are we removing this value from all keys having this value as a neighbor?

Cloud-
Автор

Nice explanation! One thing I did not quite understand is that why can we be sure that the number of roots will be either one or two and no more?

RR-jzfx
Автор

Great explanation, understood well. Thanks a lot.

gowdhamt