Problem Statement | |||||||||||||
| Given two matrices a and b, both composed of zeroes and ones, return the minimal number of operations necessary to transform matrix a into matrix b. An operation consists of flipping (one becomes zero and zero becomes one) all elements of some contiguous 3 x 3 submatrix. If a cannot be transformed into b, return -1. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
| - | a will contain between 1 and 50 elements, inclusive. | ||||||||||||
| - | a and b will contain the same number of elements. | ||||||||||||
| - | Each element of a will contain between 1 and 50 characters, inclusive. | ||||||||||||
| - | Each element of b will contain between 1 and 50 characters, inclusive. | ||||||||||||
| - | All elements of a and b will contain the same number of characters. | ||||||||||||
| - | Each element of a and b will be contain only zeroes ('0') and ones ('1'). | ||||||||||||
Examples | |||||||||||||
| 0) | |||||||||||||
| |||||||||||||
| 1) | |||||||||||||
| |||||||||||||
| 2) | |||||||||||||
| |||||||||||||
| 3) | |||||||||||||
| |||||||||||||