solve(board) — each cell of board is alive (1) or dead (0) and has eight
neighbours (horizontal, vertical and diagonal; cells outside the board count as dead).
Compute the next generation, where every cell changes at the same time:
Update the board in place and return it. The trap: if you overwrite a cell right away,
its neighbours read the wrong value. Encode the transitions in the same array instead —-1 for "was alive, now dead" and 2 for "was dead, now alive" — so a cell still tells
you its old state, then flatten the codes in a final pass.
Examples
solve([[0,1,0],[0,1,0],[0,1,0]]) → [[0,0,0],[1,1,1],[0,0,0]] // a blinker flips
solve([[1,1],[1,0]]) → [[1,1],[1,1]]Sample tests