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