I was working with a piece of code when I stumbled across a matrix, which is similar to this:
$\begin{matrix} 0&1&0&1&0&1&0&\cdots\\ 1&1&1&1&1&1&1&\cdots\\ 0&1&0&1&0&1&0&\cdots\\ 1&1&1&1&1&1&1&\cdots\\ 0&1&0&1&0&1&0&\cdots\\ \vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots \end{matrix}$
The rule is: no $0$ should be adjacent to another (diagonally/vertically/horizontally)
The matrix is my representation for the rule.
I was trying to figure out the formula for finding for any given $N \times M$ matrix (like the one above), what will be the maximum number of $0$'s possible.
Finally, I gave up and settled for a code which did the labor counted them. I was hoping if someone here could help with a formula or a better approach?