How to solve this Adjacent Infection problem? ( Please Help )

Adjacent Infection | Prepbytes