LintCode:装最多水的容器
2016-04-25 20:36
429 查看
LintCode:装最多水的容器
class Solution: # @param heights: a list of integers # @return: an integer def maxArea(self, heights): # write your code here if len(heights) == 0: return 0 max_ans = 0 min_height = heights[0] for i in range(len(heights)): if heights[i] >= min_height: min_height = heights[i] for j in range(i+1, len(heights)): area = min(heights[i], heights[j]) * (j - i) if area > max_ans: max_ans = area else: pass return max_ans
相关文章推荐
- Android中View的事件分发机制
- Docker容器与容器云
- Oracle--单行函数
- 关于linux硬盘分区的简单方法
- LeetCode OJ 104. Maximum Depth of Binary Tree
- C语言中不同变量的访问方式
- poj3579 Median
- docker容器网络通信原理分析
- (2.2.10)Gradle 介绍
- 冲刺阶段第七天
- 第一冲刺阶段(第四天)
- Android Studio中关联源码(source for Android API)的方法
- iOS设计模式
- (2.2.9.4)grovy脚本类、文件 I/O 和 XML 操作
- Python - decorator
- LeetCode *** 210. Course Schedule II
- TCP协议详解
- 并行、并发、同步和互斥
- 采用dom实现复选框全选、取消效果
- HDU-1087 Super Jumping! Jumping! Jumping!( DP )