LeetCode11:盛最多水的容器

    技术2022-07-16  77

    class Solution { public int maxArea(int[] height) { int i = 0; int j = height.length-1; int ans = 0; while(i<j){ ans = height[i]<height[j]?Math.max(ans,(j-i)*height[i++]):Math.max(ans,(j-i)*height[j--]); } return ans; } }

     

    Processed: 0.013, SQL: 9