<p>You are given an integer array <code>height</code> of length <code>n</code>. There are <code>n</code> vertical lines drawn such that the two endpoints of the <code>i<sup>th</sup></code> line are <code>(i, 0)</code> and <code>(i, height[i])</code>.</p>

<p>Find two lines that together with the x-axis form a container, such that the container contains the most water.</p>

<p>Return <em>the maximum amount of water a container can store</em>.</p>

<p><strong>Notice</strong> that you may not slant the container.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/17/question_11.jpg" style="width: 600px; height: 287px;" />
<pre>
<strong>Input:</strong> height = [1,8,6,2,5,4,8,3,7]
<strong>Output:</strong> 49
<strong>Explanation:</strong> The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> height = [1,1]
<strong>Output:</strong> 1
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>n == height.length</code></li>
	<li><code>2 &lt;= n &lt;= 10<sup>5</sup></code></li>
	<li><code>0 &lt;= height[i] &lt;= 10<sup>4</sup></code></li>
</ul>

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
static const bool Booster = [](){ std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); return true;}();inline bool is_digit(char c) { return c >= '0' && c <= '9';}std::array<int, 100000> nums;void parse_input_and_solve(std::ofstream& out, const std::string& s) { const int N = s.size(); int left = 0; int idx = 0; while (left < N) { if (!is_digit(s[left])) { ++left; continue; } int right = left; int value = 0; while (right < N && is_digit(s[right])) { value = value * 10 + (s[right] - '0'); ++right; } left = right; nums[idx] = value; ++idx; }  int area = 0, i = 0, j = idx-1; label:  area = max(area, (j-i)*min(nums[i], nums[j])); if(nums[i] < nums[j]) i++; else j--; if(i < j) goto label; out<<area<<"\n";}bool Solve = [](){ std::ofstream out("user.out"); for (std::string s; std::getline(std::cin, s);) { parse_input_and_solve(out, s); } out.flush(); exit(0); return true;}();


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