1 2 3 4 5 6 7 8 9 10 11 12
| class Solution { public int maxArea(int[] height) { int res = 0; int left = 0, right = height.length - 1; while(left < right) { res = Math.max(res, Math.min(height[left], height[right]) * (right - left)); if(height[left] <= height[right]) left ++; else right --; } return res; } }
|