Input: A[][] = { { '1', '1', '1' }, { '1', '1', '1' }, { '1', '1', '1' } }, B[][] = { { '0', '0', '0' }, { '0', '0', '0' }, { '0', '0', '0' } }, K = 3
Output: 1
Explanation:
Following are the operations performed:
Operation 1: Flip the submatrix of size K from indices (0, 0) modifies the matrix A[][] to { { '0', '0', '0' }, { '0', '0', '0' }, { '0', '0', '0' } }.
Therefore, the minimum number of flips required is 1.
Input: A[][] = { { '1', '0', '0' }, { '0', '0', '0' }, { '0', '0', '0' } }, B[][] = { { '0', '0', '0' }, { '0', '0', '0' }, { '0', '0', '0' } }, K = 3
Output: -1