Given a binary tree
,
We have to remove a single edge
and partition the tree into two new trees
such that difference of their diameters remains less than a given constant k
.
Please suggest me an approach of O(n) time complexity.
Partition a Binary Tree
Given a binary tree
,
We have to remove a single edge
and partition the tree into two new trees
such that difference of their diameters remains less than a given constant k
.
Please suggest me an approach of O(n) time complexity.