You are given the root of a binary tree with unique values, and an integer start. At minute start.
Each minute, every infected node spreads the infection to all adjacent nodes that are not yet infected. An adjacent node is defined as a node’s parent, its left child, or its right child.
Return the total number of minutes needed to infect the entire binary tree.
Constraints:
The number of nodes in the tree is in the range
Node.val
Each node has a unique value.
A node with a value of start exists in the tree.
You are given the root of a binary tree with unique values, and an integer start. At minute start.
Each minute, every infected node spreads the infection to all adjacent nodes that are not yet infected. An adjacent node is defined as a node’s parent, its left child, or its right child.
Return the total number of minutes needed to infect the entire binary tree.
Constraints:
The number of nodes in the tree is in the range
Node.val
Each node has a unique value.
A node with a value of start exists in the tree.