#K91652. Largest Rectangle in a Plot
Largest Rectangle in a Plot
Largest Rectangle in a Plot
You are given a plot represented as a matrix of characters. Each cell is either .
(free land) or #
(tree). Your task is to find the area of the largest rectangular region that is completely free of trees. In other words, find the maximum area rectangle consisting solely of .
characters.
The area of a rectangle is computed by $\text{width} \times \text{height}$.
inputFormat
The first line of the input contains two integers n and m representing the number of rows and columns of the matrix, respectively.
The next n lines each contain a string of length m consisting only of the characters .
and #
.
Note: Input is read from standard input (stdin).
outputFormat
Output a single integer which is the area of the largest rectangle that can be formed by contiguous cells containing .
(free land) only. The output should be written to standard output (stdout).
4 4
..#.
....
.#..
....
6