← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given an R×C grid that represents a population. Each cell can be in one of four states: Healthy (0), Infected (1), Recovered (2), or Immune (3). At time 0 you receive the initial configuration plus two integers N and M. Every minute the following happens in order:
Write a function that returns the first minute at which every non-immune cell is Healthy, or –1 if the infection never dies out.