← Questions

Time for an infection to spread through a binary tree

0
TeslaCodingLast asked Jan 2026

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.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding