leetcode:Container With Most Water [11]
来源:互联网 发布:网络词汇洪荒之力意思 编辑:程序博客网 时间:2024/05/07 23:07
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.
class Solution {private:int min(int a, int b) {return a < b ? a : b;}public:int maxArea(vector<int>& height) {int max = 0;int i = 0, j = height.size() - 1;while (i < j) {int Area = (j - i)*min(height[i], height[j]);if (Area > max) max = Area;if (height[i] < height[j]) i++;else j--;}return max;}};
0 0
- LeetCode 11: Container With Most Water
- leetcode 11 Container With Most Water
- Leetcode【11】:Container With Most Water
- [leetcode 11] Container With Most Water
- [leetcode 11] Container With Most Water
- LeetCode | #11 Container With Most Water
- leetcode.11---------Container With Most Water
- [LeetCode 11]Container With Most Water
- leetcode 11 Container With Most Water
- leetcode-11 Container With Most Water
- Container With Most Water - LeetCode 11
- [Leetcode 11, Medium] Container With Most Water
- LeetCode 11 - Container With Most Water
- leetcode 11 -- Container With Most Water
- #LeetCode OJ #11 Container With Most Water
- Leetcode #11 Container With Most Water
- leetcode-11Container With Most Water
- leetcode 11 -- Container With Most Water
- android任务栈与启动模式
- java中volatile关键字的含义
- 6、volatile关键字
- UE4在VR模式下去掉两侧黑边
- poj 1275 Cashier Employment
- leetcode:Container With Most Water [11]
- HDU 5802-J - Windows 10 -贪心+模拟+dfs
- Merge Into 语句代替Insert/Update
- 分支与循环
- Linux系统服务——Daemon
- php开发lamp环境搭建详解
- HDU-5802-Windows 10(DFS+贪心)
- mismatch 源码剖析
- 跟我学Redis(12)—redis发布与订阅