1. use bit operations to get the initial state; 2. init all states to be Integer.MAX_VALUE and initial state to have cost 0. 3. add the initial state to queue and do bfs: if reaching state 0, return its min cost; otherwise try all possible flips at different cells by using xor o...