In this problem, we are given input as the reference to the root of an N-ary tree.
We need to calculate the diameter of the tree that is the longest path between any two nodes using Dynamic Programming.
A tree is an extensively used data structure in the world of programming. Every node in a tree can have more further subdivisions. The bottom-most nodes of a tree that have no sub-divisions, are called the leaf nodes.
We know that in a binary tree, each node has no more than 2 children....
Published on December 08, 2020 13:23