Amazon | Onsite | Tree-DS-ALGO-Min time to infect all nodes
Anonymous User
1154

Given binary Tree Find min time require to infect all nodes.
Conditions:

Start from any leaf node. 
if one node is infected then all connected nodes  also gets infected 
Time unit is 1 unit .

Require time complexity is O(N)

Example:
image

For above tree ans is: 3

image

for above diameter of tree is :8
but ans is 6 starting from leaf node 4 number

Comments (6)