Maximal Square Area
Problem statement
Complete the function below. The function receives the full standard input as a single string and must return the exact standard output lines for the described problem.
Problem Given an m x n matrix of characters '0' and '1', find the largest square containing only '1's and return its area.
Input
First line: two integers m n
Next m lines: each is a length-n string containing only 0/1
Output
A single integer: the maximal square area
Constraints 1 <= m, n <= 300
Examples 4 5
10100
10111
11111
10010
Output:
4
2 2
00
Output:
0
Example Input
4 5
10100
10111
11111
10010
Output
4
Function
solveMaximalSquareArea(input: String) → String[] Complete solveMaximalSquareArea. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters.
Examples
Example 1
input = "4 5\n10100\n10111\n11111\n10010"return = ["4"]The returned string array must match the expected standard output lines for the sample input.
Constraints
- Use the limits and requirements stated in the prompt.