Link: https://leetcode.com/problems/amount-of-time-for-binary-tree-to-be-infected/
Solution:
Topics: BFS, graph, tree
Intuition
Not much to this problem. We just convert the tree to a graph, find the start node and then perform a BFS.
Note: there is also a very tricky DFS solution that is similar to Diameter of a binary tree…look over it.
Implementation
Visual
review