Harris wrote:
However, if you just want to find any one solution (i.e. just find a way to light up all cells), just
apply my aforementioned solution once horizontally and once vertically, end then feed the rest of the
(N-2)x(N-2) new matrix to the same function in a recursive way. With a little care on initial and final
conditions, I think this can be solved in afew lines of code, and it can always be converted to a non-
recursive version by introducing a queue as container for "closed" and "open" sub-matrices.

Perhaps you could show an example for the N=3 case. You said that for
N mod 3 == 0, you would start with


I claim that for N=3 there is no solution that has 010 in the top row.
So how do you get from 010 to a valid solution?

Even simpler, for N=2, the only solution is


and I don't see how your '10' leads to that. Can you show your steps?