#C2596. Largest Square Subgrid
Largest Square Subgrid
Largest Square Subgrid
Given a binary grid of size (n \times n) where each cell is either '0' or '1', your task is to determine the side length of the largest square subgrid that contains only ones. You will be provided with (T) test cases. For each test case, first read an integer (n) representing the grid size, followed by (n) lines of strings, each of length (n). Use dynamic programming to compute the size of the maximum square formed by consecutive ones in each grid.
inputFormat
The input begins with an integer (T) on a single line representing the number of test cases. For each test case, the first line contains an integer (n) (the grid size). This is followed by (n) lines, each containing a string of (n) characters ('0' or '1').
outputFormat
For each test case, output a single integer on a new line indicating the side length of the largest square subgrid that is comprised entirely of ones.## sample
2
3
111
111
111
4
1100
1110
0111
0111
3
2
</p>