Company: Media Net_31oct
Difficulty: medium
Binary Matrices Problem Description Given two matrices A and B of size NXM, 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. Constraints 2 <= |A|, |B| <= 10^3 0 <= A[i][j], B[i][j] <= 1 Input Format The first argument is an integer array of array A. The second argument is an integer array of array B. Output Format Return an integer, the answer to the problem. Examples Example 1: Input: A = [[1, 1], [1, 1]] B = [[0, 0], [0, 0]] Output: 1 Explanation: For Input 1: 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]] B = [[0, 0, 0], [0, 0, 0], [0, 0, 1]] Output: 1 Explanation: For Input 2: First, we can take the top left submatrix for the operation. A converts to [[0, 0, 0],