Skip to main content
PreparationZone Logo
PreparationZone
Back to Coding

Coding · Medium · Pro

Game of Life — next generation on a board

CodingMatrixSenior
Model answerPreview

Approach

  • Count live neighbors with bounds checks.
  • Apply rules in-place using second pass or offset encoding.

Java Solution

Java
void gameOfLife(int[][] b) {
    int m = b.length, n…