Grand Temple . question is not clear pls explain

question is not clear …pls give more examples

Hi @i_am_dekard_shaw
Kindly have a look at the link below, there I have explained this question.

@Aayush still not clear

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.

@Aayush
if this is the test case
3
1 1
2 4
5 2
then the max area would be under (2,2) (2,4) (5,2) (5,4) ie 6 units
but actual area is under (3,2), (3,4), (5,2), (5,4) ie 4 units…why ?
explain giving more examples pls

@i_am_dekard_shaw