You are given an board. In each move, you can swap any two rows or any two columns.
Return the minimum number of moves required to transform the grid into a valid chessboard. If it is impossible to transform the grid into a chessboard, return
A valid chessboard is a grid where no two horizontally or vertically adjacent cells contain the same value.
Constraints:
n board.length
n board[i].length
n
board[i][j] is either
You are given an board. In each move, you can swap any two rows or any two columns.
Return the minimum number of moves required to transform the grid into a valid chessboard. If it is impossible to transform the grid into a chessboard, return
A valid chessboard is a grid where no two horizontally or vertically adjacent cells contain the same value.
Constraints:
n board.length
n board[i].length
n
board[i][j] is either