A diamond mine is a matrix of ones and zeroes with R rows and C columns.
A diamond is a pattern of ones forming the boundary of a 45-degree rotated square. The diamonds of size 1, 2, and 3 are shown below.
size 1: size 2: size 3:
1 1 1
1 1 1 1 1
1 1 1
The diamond mine in this problem will be pseudo-randomly generated using the following method:
You are given two ints: seed and threshold. Let x0=seed
and for all i>=0 let xi+1 = (xi * 25173 + 13849) modulo 65536.
Process the cells of the matrix in row major order (i.e., first row left to right, second row left to right, etc.).
Each time you process a cell, look at the next xi (starting with x1 for the upper left corner).
If it is greater than or equal to threshold, the current cell will contain a 1, otherwise it will contain a 0.
Your method shall compute and return the size of the largest diamond that can be found in the mine.
If there are no diamonds, return 0.