Largest Square Submatrix of all 1's Haha Expert

Find the largest square submatrix consisting entirely of 1s as fast as possible.

Input

A 10,000 x 10,000 matrix of uint8 values (0 or 1) on STDIN.

0, 1, 0, 1, 1
0, 1, 1, 1, 1
0, 0, 1, 0, 0
1, 0, 1, 1, 0

Output

Print the side length of the largest all-ones square submatrix to STDOUT. The answer is guaranteed to be greater than 1.

For the example above, the output is:

2
Back to listOct 3, 2026 05:57Karthik ReddyKarthik ReddyError
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 3, 2026 05:570491,648,338456,949,00023,433,0002,113,536expected "64", got "A64 h28,24,25,21,17,19,19,30,15,20,14 big1 64@5169,9703 "
2Oct 3, 2026 05:570489,547,774456,303,00022,648,0002,113,536expected "70", got "A70 h21,17,21,21,24,21,20,27,17,22,21 big1 70@3268,8391 "
3Oct 3, 2026 05:570489,087,524455,734,00022,687,0002,113,536expected "50", got "A50 h26,20,26,25,15,15,24,22,21,14,23 big0 "