12 Nisan 2020 Pazar

Binary Tree Çap Hesabı


Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root.

https://leetcode.com/explore/challenge/card/30-day-leetcoding-challenge/529/week-2/3293/


>> Solution 1 - Use DFS with Recursion



>> Solution 2 - Use Post Order DFS with Two Stacks


See









Hiç yorum yok: