Game of life step
Your task
Implement one step of Conway's Game of Life on an m x n board of 0s and 1s, updating the board IN PLACE (you may not allocate a second full board) and return the updated board. Rules: a live cell with 2 or 3 live neighbors survives; a dead cell with exactly 3 live neighbors becomes live; all others die or stay dead. Neighbors are the 8 surrounding cells. The board may be up to 100 x 100.
Examples
game_of_life(board: list[list[int]]) -> list[list[int]]Example 1
Input
game_of_life([[0, 1, 0], [0, 0, 1], [1, 1, 1], [0, 0, 0]])Output
[[0, 0, 0], [1, 0, 1], [0, 1, 1], [0, 1, 0]]