Doubt-Grand Temple

Please explain this question to me.

In this question you are given that there are some watchtowers at different coordinates (x,y). Now 2 rivers flow horizontally and vertically and they intersect at this tower.
hhnZpEJ

Here you can see that there are 3 towers at (8,6), (3,8) and (11,2) and for each of them 2 rivers (1 horizontal and the other vertical and flowing and intersecting at the respective (x,y)).
Given this arrangement the rest of the space left in the grid(the white portion in image) is land.
Now the king wants to build a temple and he wants to do that on the largest area available. Now you are required to find out and print the area of the largest land which is available and in which the king can build a temple.
Hints :
This is a pretty simple problem. All we need to do is just store all the X and Y coordinates and then sort them. Then we will calculate maximum ΔX and ΔY where ΔX = (Xi -Xi-1) & ΔY = (Yi -Yi-1). Then the area will be (ΔY-1)*(ΔX-1)

Dry run the sample test case.you will get this logic
All we need to do is just store all the X and Y coordinates and then sort them. Then we will calculate maximum ΔX and ΔY where ΔX = (Xi -Xi-1) & ΔY = (Yi -Yi-1). Then the area will be (ΔY-1)*(ΔX-1).

We have to find the maximum area of land(so we exclude the rivers).
Clearly the maximum area would be between the intersection points of (2,4) and (5,2) for the given sample testcase.

Area = | 5 - 2 - 1 | * | 2 - 4 - 1| = 2 * 1 = 2

We implement the formula ,
Area = abs( y2 - y1 - 1) * abs( x2 - x1 - 1)//take abs as area cant be negative

We add an extra -1 in our calculation since we should consider the river area. If we simply implement (y2 - y1) or (x2 - x1) then we would end up counting 1 edge of the vertical river and 1 edge of the horizontal river. We should not include that area as the temple cannot be built over the river edge.

Hope this helps