Time for an infection to spread through a binary tree

0
Remix

A binary tree catches fire (or an infection) at one given node. Every minute it spreads to the neighbours of each burning node: its children and its parent. Return how many minutes it takes for the whole tree to burn. Build parent links (or an adjacency list) and run a BFS from the start node.

TeslaCodingLast asked Jan 2026
No answer yet. Write the first one; the best answer gets endorsed.