Container With Most Water
来源:互联网 发布:淘宝2016年韩版羽绒服 编辑:程序博客网 时间:2024/05/21 19:26
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: # @return an integer def maxArea(self, height): ret,left,right=-1,0,len(height)-1 while left < right: ret=max(ret,(right-left)*min(height[left],height[right])) if height[left] < height[right]: left=left+1 else: right=right-1 return ret
0 0
- Container With Most Water
- Container with most water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- Container With Most Water
- C++中的类所占内存空间总结
- 关于jsp页面是放在webroot目录下和web-inf下优缺点
- sa --提升到管理员
- openjudge 数算练习 线性表 0217:神奇的幻方
- Leetcode_num15_Maximun Subarray
- Container With Most Water
- unity3d camera的使用(原)
- 习近平就从严治党提八要求:不准搞帮派
- zoj 1100 - Mondriaan's Dream
- Spring3中定时器的配置使用之Quartz
- 1430 素数判定
- Android手机分辨率基础知识(DPI,DIP计算)
- 会让桌面滚动的代码
- postgresql的java实例肯定可用