My BFS solution. count starts at 2 and every time the search moves one level deeper, count is incremented and the board state is printed out. I use the board itself to track each level of infection. If you don't want to use the board, you can extend the Pair class with a count value. Alternatively you can post process the board to replace every value >2 with 2.
If there are any grid squares that cannot be infected (surrounded with 0s) you can check the board at the end for any 1s left and print something else accordingly.
Output:Level 1: 2 3 1 3 3 0 0 0 1 Level 2: 2 3 4 3 3 0 0 0 4 Total seconds elapsed : 2