Container With Most Water
2015-12-03 14:38
525 查看
var maxArea = function(height) { var max = 0, l = 0, r = height.length - 1; while (l < r) { var capacity = (r - l) * Math.min(height[l], height[r]); max = capacity > max ? capacity : max; if (height[l] < height[r]) { l++; } else { r--; } } return max; };
相关文章推荐
- QPainter::begin: Paint device returned engine == 0, type: 1
- tail -f 查看多个日志文件
- 构建内部邮件服务器(DNS+sendmail)
- DHCP Failover中的Filter同步
- 点滴 PUSH-PULL AND OPEN DRAIN+PULL-UP/DOWN
- LeetCode(217)Contains Duplicate
- LeetCode(217)Contains Duplicate
- 软件包 com.baidu.location
- hdu 1788 Chinese remainder theorem again
- 设计模式 职责链模式(Chain of Responsibility Pattern)
- 14.9.5 Reclaiming Disk Space with TRUNCATE TABLE 回收磁盘空间使用TRUNCATE TABLE
- poj--1237--Drainage Ditches(最大流)
- 约束3(constrains)
- poj--1237--Drainage Ditches(最大流)
- POJ1804 Brainman
- 约束2(constraints)
- 如何写一封彬彬有礼的英文email给国外学者
- 256. Paint House
- UVa 11078 Ai-Aj(i<j)的最大值
- Unable to save settings: Failed to save settings. Please restart IntelliJ IDEA 解决方案