minutes to keep track of the time passed.minutes.
b. Process all nodes at the current level of BFS.
c. For each node, add its unvisited children and parent to the queue.
d. Mark the node as visited.minutes - 1 as the last increment happens after the last node is infected.