The idea is : to compute area, we need to take min(height[i],height[j]) as our height. Thus if `height[i]<height[j]`

, then the expression `min(height[i],height[j])`

will always lead to at maximum `height[i]`

for all other j(i being fixed), hence no point checking them. Similarly when `height[i]>height[j]`

then all the other i's can be ignored for that particular j.

```
class Solution {
public:
int maxArea(vector<int> &height)
{
int j=height.size()-1,i=0,mx=0;
while(i<j)
{
mx=max(mx,((j-i)*(min(height[i],height[j]))));
if(height[i]<height[j])
i++;
else if(height[i]>=height[j])
j--;
}
return mx;
}
};
```