# [11\. Container With Most Water](https://leetcode.com/problems/container-with-most-water/) :::spoiler Solution ```cpp= class Solution { public: int maxArea(vector<int>& height) { int left = 0, right = height.size() - 1; int res = 0, curArea = 0; while(left < right) { curArea = min(height[left], height[right]) * (right - left); res = max(res, curArea); if(height[left] < height[right]) ++left; else --right; } return res; } }; ``` - T: $O(N)$ - S: $O(1)$ :::