← All problems

Game of Life (in-place)

Medium matrixsimulation LeetCode ↗
Compute the next state of Conway's Game of Life on a grid in place: each cell's next state depends on its eight neighbors' current states, so the update must not clobber data still needed.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(mn), Space O(1)

Common pitfalls

  • Extra board (violates in-place)
  • Counting transitional states as live/dead wrong

Your solution

Log in to save your code and track progress.