Company: Media Net_31oct
Difficulty: medium
Binary Matrices Problem Description You are given two NxM matrices, A and B, whose entries are all either 0 or 1. On matrix A, you may repeatedly apply an operation: pick any 2x2 submatrix of A and flip every entry A[i][j] inside it (replace each with A[i][j] XOR 1), for every (i,j) in that submatrix. Determine whether repeated applications of this operation can turn A into B. Return 1 if it is possible, and 0 otherwise. 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: There is only one 2x2 submatrix to pick here, and flipping it turns A directly 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: Flipping the top-left 2x2 submatr