public int maxArea(int[] height) {
int left = 0, right = height.length - 1;
int maxArea = 0; while (left < right) {
maxArea = Math.max(maxArea, Math.min(height[left], height[right])
* (right - left));
if (height[left] < height[right])
left++;
else
right--;
} return maxArea;
}
相关文章
- Leed code 11. Container With Most Water
- Container With Most Water -- LeetCode 11
- LeetCode解题报告—— Container With Most Water & 3Sum Closest & Letter Combinations of a Phone Number
- [Leetcode] Container With Most Water ( C++)
- [LeetCode] Container With Most Water 装最多水的容器
- 7 Container With Most Water_Leetcode
- 如何装最多的水? — leetcode 11. Container With Most Water
- LeetCode--11_Container_With_Most_Water
- LeetCode--No.011 Container With Most Water
- LeetCode Array Medium 11. Container With Most Water