I have MATRIX(m*n) fill with bool (0 or 1)
When we position x,y near position and center will reverse (x,y),(x+1,y),(x-1,y),(x,y+1),(x,y-1)
And we have to press some position to make it transform to some matrix that we want to
11111 1-111 1-1-1 1-1-1
11111 press(2,2)-> ---11 press(2,4)-> --1-- press(3,2)-> -11--
11111 1-111 1-1-1 -1--1
11111 11111 11111 1-111
This problem can use permutation but it's too slow O(2^(n*m)) we can make some condition to make it faster but it still slow for me.
Can you tell me what is this problem name and is it have algorithm better than permutation?