首页 > 代码库 > [LeetCode] Container With Most Water

[LeetCode] Container With Most Water

public class Solution {    public int maxArea(int[] height) {        int len = height.length, low = 0, high = len - 1;        int area = 0;        while (low<high) {            area = Math.max(area, (high-low)* Math.min(height[low], height[high]));            if (height[low] > height[high]) high --;            else low++;        }        return area;    }}

 

[LeetCode] Container With Most Water