Problem Statement | |||||||||||||
You are given a String[] data representing a rectangular grid where each cell contains a digit.
Find the largest square in this grid that contains the same digit in all of its corner cells.
The sides of the square must be parallel to the sides of the grid.
If there is more than one such largest square, pick any one of them.
Return the number of cells in the square. Note that a single cell is also considered a square, so there will always be an answer. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | data will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of data will contain between 1 and 50 digits ('0'-'9'), inclusive. | ||||||||||||
- | All elements of data will have the same length. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|