楼主: 
yam276 ('_')   
2023-10-13 17:56:49LeetCode Blind Curated 75:https://leetcode.com/list/xoqag3yj/
11. Container With Most Water
https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/17/question_11.jpg
找最高水面
由两边较高的高度决定
思路:
普通的双指标题目
Code:
impl Solution {
    pub fn max_area(height: Vec<i32>) -> i32 {
        let mut left = 0;
        let mut right = height.len() - 1;
        let mut result = 0;
        while left < right {
            let water = (right - left) as i32 * height[left].min(height[right]
);
            result = result.max(water);
            if height[left] < height[right] {
                left += 1;
            } else {
                right -= 1;
            }
        }
        result
    }
}