Problem Statement | |||||||||||||
Given the elevations of a plot of land, determine the deepest lake that could exist on the plot. Assume that water will flow off the edge of the plot, and therefore a lake will not cover any land on the border. A lake could form at a location up to level h so long as there is no path of horizontal or vertical steps from the lake to the edge of the plot that is completely below h. For example, consider the following plot:5255 5225 5525 5515 5555A lake will form up to level 2 where the 1 is. You will be given a String[], plot, where the ASCII value of plot[i][j] represents the height of the land at location (i,j). Your task is to determine the deepest lake that could form in the plot, where the depth of a lake is the largest difference between the lake height and the height of the land under the water. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | If no lake can form, return 0. | ||||||||||||
Constraints | |||||||||||||
- | plot will contain between 3 and 50 elements, inclusive. | ||||||||||||
- | Each element of plot will contain between 3 and 50 characters, inclusive. | ||||||||||||
- | Each element of plot will be the same length. | ||||||||||||
- | Each character in plot will have an ASCII value between 32 and 126, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|