Leetcode Container With Most Water
来源:互联网 发布:淘宝网迪士尼保温杯 编辑:程序博客网 时间:2024/05/21 09:21
题意:找到蓄水量最大的容器。
思路:从两边开始找,每次更新较小的边。
class Solution {public: int maxArea(vector<int>& height) { int low = 0; int high = height.size() - 1; int maxwater = 0; while(low < high) { maxwater = max(maxwater, (high - low) * min(height[low], height[high])); if(height[low] > height[high]) high --; else low ++; } return maxwater; }};
0 0
- LeetCode: Container With Most Water
- [LeetCode]Container With Most Water
- LeetCode Container With Most Water
- LeetCode: Container With Most Water
- [Leetcode] Container With Most Water
- Leetcode: Container With Most Water
- [LeetCode] Container With Most Water
- LeetCode Container With Most Water
- [Leetcode] Container With Most Water
- [LeetCode]Container With Most Water
- LeetCode-Container With Most Water
- Container With Most Water leetcode
- LeetCode - Container With Most Water
- LeetCode: Container With Most Water
- Leetcode: Container With Most Water
- 【LeetCode】Container With Most Water
- Leetcode: Container With Most Water
- LeetCode:Container With Most Water
- UVa 1225 - Digit Counting
- ubuntu14.04 samba服务器安装配置
- 基于NoHttp+RxBus+MVP实现网络文件下载(带进度条)
- 做独特的自己
- TreeList递归生在
- Leetcode Container With Most Water
- centos7.0之Lnmp和Lamp
- SQL注入漏洞的防案
- IOS-OC-蓝牙写入数据代理没回调的问题。
- 通配符(WildCard)与正则表达式(Regular Expression)
- Android OkHttp文件上传与下载的进度监听扩展
- Fragment之间传递数据的三种方式
- mysql explain用法
- 禁用Apache的Options和Trace方法