11【Leetcode】 Container With Most Water
来源:互联网 发布:c语言随机数 编辑:程序博客网 时间:2024/06/03 17:02
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 and n is at least 2.
class Solution(object): def maxArea(self,height): if len(height)<2: return 0 else: i = 0 j = len(height)-1 maxlen = (j-i)*min(height[i],height[j]) while(i!=j): maxlen = max(maxlen,(j-i)*min(height[i],height[j])) if height[j]>height[i]: i+=1 else: j-=1 return maxlen
阅读全文
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
- 五种方式让你在java中读取properties文件内容不再是难题
- Hive安装
- 以当前时间命名文件并保存实时采集数据
- 编译原理第一个项目——个人所得税PersonalTax
- awk简单使用
- 11【Leetcode】 Container With Most Water
- SPI通信协议(SPI总线)学习
- 伴随多态的可互换对象(thinking in java)
- Qt Multimedia::QMediaPlayer框架源码分析
- 卸载N卡驱动
- 第三周项目1
- 电路板线路板 PCB 开发设计分享教程之( 4) --芯片元件库 的绘制--1.DIP 元件的原理图库
- TCP三次握手和四次挥手内容
- android学习---活动的启动方式