Largest Square Matrix with Same Value
Given a two-dimensional list of integers matrix
, find the largest k × k
submatrix such that all of its elements are the same value, and return the k
.
Constraints
n, m ≤ 250
wheren
andm
are the number of rows and columns inmatrix
.
https://binarysearch.com/problems/Largest-Square-Matrix-with-Same-Value
Examples
Example 1
Input
- matrix =
[[1,1,3],
[1,1,3],
[5,5,5]]
Output
- answer =
2
Explanation
There’s a 2 × 2
square of 1
s on the top left.
Leave a comment