accord Wikipedias article the Game Life know simply Life cellular automaton devise british mathematician John Horton Conway 1970The board m x n grid cell cell initial state live represent 1 dead represent 0 each cell interact neighbor horizontal vertical diagonal follow rule take Wikipedia articleany live cell few live neighbor die cause underpopulationany live cell live neighbor live generationany live cell live neighbor die overpopulationany dead cell exactly live neighbor live cell reproductionThe state create apply rule simultaneously cell current state birth death occur simultaneously give current state m x n grid board return state Example 1input board 010001111000output 000101011010example 2input board 1110output 1111 Constraintsm boardlengthn boardilength1 m n 25boardij 0 1 Follow upcould solve inplace Remember board need update simultaneously you update cell use update value update cellsin question represent board 2D array in principle board infinite cause problem active area encroach border array ie live cell reach border how address problem