Given a n by m matrix of bits find the largest X that is formed in the matrix and return the size of the diagonal of that X. An X is defined as 2 equally sized diagonals that share a single 1.
For instance, the matrix:
00100001
00010010
00001100
00001100
00010010
00100001
Will return a size of 1, because the given X is invalid as the middle part does not share a single 1. On the other hand, the following matrix
101
010
101
Will return a value of 3, as the diagonal is 3. Write such program,
For instance, the matrix:
00100001
00010010
00001100
00001100
00010010
00100001
Will return a size of 1, because the given X is invalid as the middle part does not share a single 1. On the other hand, the following matrix
101
010
101
Will return a value of 3, as the diagonal is 3. Write such program,
No comments:
Post a Comment