Please help me to understand the question. According to my understanding, I am getting 6 as the answer.
Unable To Understand The Test Case
@zanj0
We are to find the maximum area available to us between 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 the abs value as we are computing the area and area cannot 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.
1 Like