There are
Every day, the state of all cells changes simultaneously based on these rules:
A cell becomes occupied with a value of
Otherwise, the cell becomes vacant with a value of
Since the first and last cells in the row lack two adjacent neighbors, they cannot satisfy the condition and become vacant with a value of
Given an integer array cells representing the initial state of the prison and an integer n, return the state of the prison cells after n days.
Constraints:
cells.length is equal to
cells[i] is either
There are
Every day, the state of all cells changes simultaneously based on these rules:
A cell becomes occupied with a value of
Otherwise, the cell becomes vacant with a value of
Since the first and last cells in the row lack two adjacent neighbors, they cannot satisfy the condition and become vacant with a value of
Given an integer array cells representing the initial state of the prison and an integer n, return the state of the prison cells after n days.
Constraints:
cells.length is equal to
cells[i] is either