I'm having a hard time conceptually understanding the following question:
A virus has infected your computer lab. If a computer has the virus it can spread to any computer that is not infected. The input, computer_lab
, is a 2D array of 1s and 0s representing the computers in the lab.
Example 2D matrix computer_lab
input:
1 0 1 0 0
0 1 0 1 1
0 1 1 1 0
1 0 0 0 0
1 1 1 1 1
- A 0 at (X,Y) means computer X can't reach computer Y
- A 1 at (X,Y) means computer X can reach computer Y
Can anyone explain the above statements? How can an ordered pair be used to reference a 2D array? Is this asking to treat the 2D matrix as a graph?
Additionally, if you're given another input, sick_machines
, that represents the computers that already have a virus, but the input is given as an array of N integers, what do these integers represent in context of the 2D matrix?
i.e. sick_machines = [2,3,7]