Company: Media_Net__SDE_17nov
Difficulty: medium
Binary Matrices Problem Description Given two matrices A and B of size N X N, all the elements are either 0 or 1. We perform an operation on matrix A any number of times. We choose any 2x2 submatrix of A and make each element A[i][j] = A[i][j] XOR 1 for each (i, j) in this submatrix. Check if it is possible to convert A into B. Return 1 if possible and 0 if not. Examples Example 1: Input: A = [[1, 1], [1, 1]] B = [[0, 0], [0, 0]] Output: 1 Explanation: There is only 1 possible submatrix to select. This converts A into B. Example 2: Input: A = [[1, 1, 0], [0, 0, 0], [1, 1, 1]] B = [[0, 0, 0], [0, 0, 0], [0, 0, 1]] Output: 1 Explanation: First, we can take the top left submatrix for the operation. A converts to [[0, 0, 0], [1, 1, 0], [1, 1, 1]]. For the next operation, we take the bottom left submatrix. Now, A is converted to B. Constraints 2 <= N <= 10^3 (where N is the dimension of matrices A and B) 0 <= A[i][j], B[i][j] <= 1