Wrong Test Case

• Test case 15 is wrong
Input is
[[0,0,0,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,0,0,0]]
Applying all given rules to it
Output cannot be
[[0,0,0,0,0],[0,0,0,0,0],[0,1,1,1,0],[0,0,0,0,0],[0,0,0,0,0]]

Can anyone/author of test case please explain how this is correct result given the 4 rules

• That output is correct and I have no clue why you think it's wrong. Please tell us a specific cell and why you think it's wrong.

You can also see that case among the examples on the wikipedia page. It's the "Blinker".

• The Rules were as follows
Any live cell with fewer than two live neighbors dies, as if caused by under-population.
Any live cell with two or three live neighbors lives on to the next generation.
Any live cell with more than three live neighbors dies, as if by over-population..
Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.

Applying Rule 1 cell[1][2] becomes zero
Also the only way to make dead cell alive is to have 3 live neighbors
cell[2][1] does not contain 3 live neighbors but it becomes alive in test case.
which is not possible

• "Applying Rule 1 cell[1][2] becomes zero"

The expected output does have zero there.

"cell[2][1] does not contain 3 live neighbors"

It does. The three live cells in the input are among its neighbors.

• You can also see that case among the examples on the wikipedia page. It's the "Blinker".

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.