Burning a Binary Tree (Time to Burn Entire Tree)

Given a binary tree, one node is set on fire at time t=0. Fire spreads each unit time from a burning node to its adjacent nodes (adjacent means parent or child).

Compute the time needed to burn the...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: