java leetode Container With Most Water
来源:互联网 发布:淘宝店铺发布二手产品 编辑:程序博客网 时间:2024/06/05 22:14
left = 0;
right = length-1;
if we want to get a bigger area. the only way we can do is move the smaller side forward to another side.
the code is bellow.
public class Solution { public int maxArea(int[] height) { int left = 0; int right = height.length -1; int max = Math.min(height[left],height[right])*(height.length - 1); while(left < right) { int temp = 0; if(height[left] <= height [right]) left++; else right--; temp = Math.min(height[left],height[right])*(right - left); if(temp > max) max = temp; } return max; }}
0 0
- java leetode Container With Most Water
- Container With Most Water (Java)
- (java)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
- tomcat6\webapps\manager does not exist or is not a readable directory
- C/C++随机数的产生
- TCP/IP详解卷2:实现 第二章mbuf:存储器缓存 笔记二
- 机器学习综述——机器学习理论基础与发展脉络
- Java编程中“为了性能”需做的26件事
- java leetode Container With Most Water
- 自定义一个自动滚动的SCrollView
- 延时显示
- HDU1001
- C++访问控制权限
- Java Web 服务性能优化实践
- Best Time to Buy and Sell Stock III
- 数据库事务隔离级别
- Linux学习笔记一