LeetCode11:Container With Most Water
public int MaxArea(int[] height) {
int start=;
int end=height.Length-;
int max=;
while(start<end)
{
max=Math.Max(max,Math.Min(height[start],height[end])*(end-start));
if(height[start]<height[end])
start++;
else
end--;
}
return max;
}
LeetCode11:Container With Most Water的更多相关文章
- No.011:Container With Most Water
问题: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, a ...
- LeetCode第[11]题(Java):Container With Most Water 标签:Array
题目难度:Medium Given n non-negative integers a1, a2, ..., an, where each represents a point at coordina ...
- LeetCode第[11]题(Java):Container With Most Water (数组容器盛水)——Medium
题目难度:Medium Given n non-negative integers a1, a2, ..., an, where each represents a point at coordina ...
- Leetcode11 Container With Most Water 解题思路 (Python)
今天开始第一天记录刷题,本人编程小白,如果有写的不对.或者能更完善的地方请个位批评指正! 准备按tag刷,第一个tag是array: 这个是array的第一道题:11. Container With ...
- [LintCode] Container With Most Water 装最多水的容器
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). ...
- 67. Container With Most Water
Container With Most Water Given n non-negative integers a1, a2, ..., an, where each represents a poi ...
- LeetCode:Container With Most Water,Trapping Rain Water
Container With Most Water 题目链接 Given n non-negative integers a1, a2, ..., an, where each represents ...
- No.011 Container With Most Water
11. Container With Most Water Total Accepted: 86363 Total Submissions: 244589 Difficulty: Medium Giv ...
- 关于Container With Most Water的求解
Container With Most Water 哎,最近心情烦躁,想在leetcode找找感觉,就看到了这题. 然而,看了题目半天,硬是没看懂,于是乎就百度了下,怕看到解题方法,就略看了下摘要,以 ...
随机推荐
- SAP MM 没有维护MRP 视图的物料可以正常参与采购业务
SAP MM 没有维护MRP 视图的物料可以正常参与采购业务 Material number: R000006872,没有维护MRP 视图, 也就是没有指定该物料来源是采购还是自制.此种情况下,S ...
- centos6 自带python2.6升级python2.7+
centos6系统自带Python为2.6.6版本,升级搞版本操作如下(python2-python3都一样) 1.下载需要升级的python包 官方下载地址:https://www.python.o ...
- Dynamics 365 Online-Unified User Interface
为了加强界面的一致性,提高用户体验,Dynamics 365 Online V9发布了新的Interface:Unified User Interface. 区别于旧的Regular UI,UUI自适 ...
- IntelliJ IDEA常用快捷键(一)
Ctrl+J 键常用的组合 psvm:public static void main(String[] args) { } Serr: System.err.println("") ...
- [20180926]查询相似索引.txt
[20180926]查询相似索引.txt --//有时候在表上建立索引比如A,B字段,可能又建立B字段索引,甚至A字段索引以及B,A字段索引,或者还建立C,A字段索引,--//需要有1个脚本查询这些索 ...
- 关于wordpress慢的问题
随笔记载: 关于wordpress访问慢的原因,主要是wordpress采用了google前端库, 需替换wordpress/wp-includes/script-header.php中所有的goog ...
- JAVA枚举带赋值
/*媒体类型*/ public enum MediaType { html(0), video(1), audio(2);private final int value; MediaType(int ...
- js中实现隐藏部分姓名或者电话号码
项目需要, 只显示用户的姓名和手机号开头跟结尾, 其他部分用 * 代替, 借鉴了网上的代码, 参考地址没来得及记下 hidden:function(str,frontLen,endLen) { var ...
- Java数据结构简述
1.数组 概念:一个存储元素的线性集合. 数组声明和创建: dataType[] arrayRefVar = new dataType[arraySize]; 二维数组(多维数组)声明和创建: dat ...
- nodejs前后分离
proxy: { '/api': { target: 'http://localhost:3000/', pathRewrite: {'^/api' : ''}, changeOrigin: true ...