Data Structures & AlgorithmsHardTCS NQT Digital · Product Company SDE

Problem: A Conway's Game of Life grid on a 4×4 board with alive cells at (1,0), (1,1), (1,2), (0,2) is advanced by one generation (standard rules; cells outside the board are dead). How many cells are alive after one generation?

  1. A. 5
  2. B. 4
  3. C. 3
  4. D. 6

Correct answer: B. 4

Count live neighbours per cell, then apply the survival (2 or 3) and birth (exactly 3) rules to the whole board simultaneously. Updating cells in place while scanning changes the counts.

More Coding Interview Problems questions

Exams that ask this topic