Grid Infection with Immune Cells Until Stable
Complete the function below. The function receives the full standard input as a single string and must return the exact standard output lines for the described problem.
Problem
Extending the previous problem, the grid may also contain immune cells 'I':
'I' can never be infected.
'I' does not infect others (it is not counted as infected).
Each day (synchronously), any healthy '.' cell with at least T infected 'X' neighbors among its 8 neighbors becomes 'X'. 'I' always stays 'I'.
Return the number of days until the grid becomes stable (no new infections occur).
Example
Input
3 3
1
I..
.X.
...
Output
1
Complete solveGridInfectionWithImmuneCells. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters.
input = "3 3\n1\nI..\n.X.\n..." return = ["1"]
The returned string array must match the expected standard output lines for the sample input.
Use the limits and requirements stated in the prompt.
- Grid Infection Spread Until StablePHONE SCREEN · Seen May 2026
- Infection Spread / Cellular AutomataPHONE SCREEN · Seen May 2026
- Chat Event Counts in Recent WindowPHONE SCREEN · Seen May 2026
- Grid Infection with Recovery After D DaysPHONE SCREEN · Seen May 2026
- ChatApp with BotsPHONE SCREEN · Seen May 2026
- IP Address to CIDR BlocksPHONE SCREEN · Seen May 2026
- Count Valid SequencesSeen Jan 2025
- Maximize The HitsSeen Sep 2024
public String[] solveGridInfectionWithImmuneCells(String input) {
// write your code here
}