最大盛水
https://leetcode.cn/problems/container-with-most-water/
var maxArea = function(height) {
// 左右指针靠拢
let left = 0;
let right = height.length-1;
let maxArea = 0;
while(left<right){
// 计算出 当前的容积 与最大容积比较,取出最大的
const currentArea = (right - left)*Math.min(height[left],height[right]);
maxArea = Math.max(maxArea,currentArea);
// left 向内移动
if(height[left] < height[right]){
left++;
}else{
right--;
}
}
return maxArea;
}