Container With Most Water 盛最多的水
来源:互联网 发布:java中有哪些集合框架 编辑:程序博客网 时间:2024/05/16 00:42
class Solution {
public:
int maxArea(vector<int> &height) {
int l=0;
int r=height.size()-1;
int ret=0;
int area=0;
while(l<r)
{
area=min(height[r],height[l])*(r-l);
ret=max(ret,area);
if(height[l]<height[r])
l++;
else
r--;
}
return ret;
}
};
public:
int maxArea(vector<int> &height) {
int l=0;
int r=height.size()-1;
int ret=0;
int area=0;
while(l<r)
{
area=min(height[r],height[l])*(r-l);
ret=max(ret,area);
if(height[l]<height[r])
l++;
else
r--;
}
return ret;
}
};
0 0
- Container With Most Water 盛最多的水
- Container With Most Water (容器中盛最多的水)
- LeetCode | Container with most water(装最多的水)
- Container With Most Water 装最多的水
- Container With Most Water(能装最多水的容器)
- Container With Most Water "最多盛水问题"
- LeetCode 11. Container With Most Water(盛最多的水)
- 含水最多的容器(Container With Most Water)
- Container With Most Water容器盛水
- Container With Most Water 求容器里能放最多的水 @LeetCode
- Container With Most Water --装最多水的容器(重)
- LeetCode OJ 之 Container With Most Water(能装最多水的容器)
- 383.Container With Most Water-装最多水的容器(中等题)
- Leetcode刷题记——11. Container With Most Water(装最多水的容器)
- 383.Container With Most Water-装最多水的容器(中等题)
- 6.container-with-most-water(装最多水的容器)
- 11. Container With Most Water(求能装最多水的容器)
- Container With Most Water
- Device Tree Usage
- 《UNIX环境高级编程》笔记--非阻塞IO
- 切水果游戏中的刀的实现
- 如何让BACK键变为HOME键
- 带ROLLUP或CUBE运算的GROUP BY
- Container With Most Water 盛最多的水
- 一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10
- 111
- (四)maven生命周期
- SharePoint Foundation 2013在Windows Server 2008 r2 sp1中搭建的全过程
- IOS MPMoviePlayerViewController 获取当前音频文件播放时间点
- java自定义异常类
- JS:超实用的JavaScript技巧及最佳实践(上)
- Effective stl 第一章 第10条