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