Container With Most Water 装最多的水
来源:互联网 发布:至尊网络电视tv 编辑:程序博客网 时间:2024/05/08 22:39
Container With Most Water
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.
Note: You may not slant the container.
class Solution {public: int maxArea(vector<int> &height) { int left,right,max,area; int len=height.size(); left=0; right=len-1; max=0; while(left<right) { area=(right-left)*(height[left]<height[right]?height[left]:height[right]); if(area>max) { max=area; } if(height[left]<height[right]) { left++; } else { right--; } } return max; }};
0 0
- LeetCode | Container with most water(装最多的水)
- Container With Most Water 装最多的水
- Container With Most Water(能装最多水的容器)
- Container With Most Water 盛最多的水
- Container With Most Water (容器中盛最多的水)
- 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(装最多水的容器)
- 含水最多的容器(Container With Most Water)
- Container With Most Water "最多盛水问题"
- Container With Most Water 求容器里能放最多的水 @LeetCode
- LeetCode 11. Container With Most Water(盛最多的水)
- 11. Container With Most Water(求能装最多水的容器)
- Container With Most Water
- Container with most water
- Class.isAssignableFrom(Class clz)方法 与 instanceof 关键字的区别
- Android Build及相关类
- VTK读取DICOM图像
- Html5和JS
- SQL查询中文字首字符
- Container With Most Water 装最多的水
- Apache与Tomcat联系及区别
- 进程切换分析篇
- Valid Palindrome--LeetCode
- ANSI_PADDING
- Integer to Roman 整数转换为罗马字符
- C# + tesseract 8位图( 调色板索引)的简单消噪和验证码破解的实现
- 2015去哪儿笔试题目(一)
- List和ArrayList的区别