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:52Karthik 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:520489,099,513456,130,00022,360,0002,113,536expected "74", got "A74 h25,25,28,19,17,23,21,14,33,15,17 big1 74@5161,2513 "
2Oct 3, 2026 05:520490,082,550455,284,00022,876,0002,113,536expected "50", got "A50 h32,19,18,26,21,18,24,19,17,21,26 big0 "
3Oct 3, 2026 05:520488,961,201455,760,00022,630,0002,113,536expected "50", got "A50 h21,18,18,18,22,28,24,27,17,14,18 big0 "