Company: Commvault_3sep
Difficulty: medium
Infection in Wonderland Problem Description Wonderland is represented as a grid with R rows and C columns. The cell at the i th row from the top and j th column from the left is called a room (i, j). Some rooms are initially infected, and the infection spreads every minute. At each minute, any non-infected room (denoted by '.') that is adjacent (up, down, left, or right) to an infected room (denoted by '#') becomes infected. Your task is to determine the minimum time required for all rooms to become infected, so that no safe room remains in Wonderland. Examples Example 1: Input: 3 4 .#.. .#.. ..#. Output: 2 Explanation: The initial grid is as follows: .#.. .#.. ..#. Then, the state of the grid after the 1 st minute is as follows: ###. ###. .### And, the state of the grid after the 2 nd minute is as follows: #### #### #### Therefore, the minimum time required for all rooms to become infected is 2 minutes. Constraints 2 ≤ R, C ≤ 1000 The given grid has at least one infected room. T