Medium Accuracy: 27.94% Submissions: 2822 Points: 4
Given a matrix where every element is either ‘O’ or ‘X’, find the largest subsquare surrounded by ‘X’.
First line contains number of test cases T. For each test case, first line contains the integer value 'N' denoting the order of square matrix. Last line contains NxN elements in a single line in row-major order.
Print the size of largest subsquare surrounded by ‘X’.
X X X X
X X X O X O X X X X X O X O X X
Explaination: In first example above, input represents following matrix of size 2 x 2
The largest square submatrix surrounded by X is the whole input matrix.
In second example above, input represents following matrix of size 4 x 4 X X X O
X O X X
X X X O
X O X X
The square submatrix starting at (0,0) and end at (2,2) is the largest submatrix surrounded by ‘X’.
Therefore, size of that matrix would be 3.