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找找感觉,就看到了这题. 然而,看了题目半天,硬是没看懂,于是乎就百度了下,怕看到解题方法,就略看了下摘要,以 ...
随机推荐
- Linux 安装 Mysql 5.7.23
切换目录 cd /usr 创建目录 mkdir mysql cd mysql 下载 Mysql Yum wget http://repo.mysql.com/mysql57-community-rel ...
- docker swarm 集群进入某节点容器失败的原因及解决方法
今日在自己的docker swarm 测试环境中,想进入某个节点的容器去查看下,结果进入容器失败,并且报了如下错误信息: [root@worker1 ~]# docker exec -it 9a6f6 ...
- 冒泡排序算法的C++实现
直接上代码: #include <iostream> using namespace std; void BubbleSort(int arr[],int n){ ) //在本例中,第1次 ...
- (后端)SpringBoot中Mybatis打印sql(转)
原文地址:https://www.cnblogs.com/expiator/p/8664977.html 如果使用的是application.properties文件,加入如下配置: logging. ...
- Git忽略规则及.gitignore规则不生效的解决办法(转)
在git中如果想忽略掉某个文件,不让这个文件提交到版本库中,可以使用修改根目录中 .gitignore 文件的方法(如无,则需自己手工建立此文件).这个文件每一行保存了一个匹配的规则例如: 1 2 3 ...
- python3接收、解析邮件
邮件接收 python3可以使用poplib.POP3进行邮件接收,具体如下: import poplib from email.parser import Parser def get_email( ...
- Unity网页游戏
Unity网页游戏是跑在浏览器的UnityWebPlayer插件中的,运行的模式是webplayer.unity3d+html 在嵌入UnityWebPlayer的网页中会调用UnityObject2 ...
- Json.net日期格式化设置
Json.net默认的时间格式化后带T,不符合一般的业务要求,重新设置JSON.NET的默认日期格式化方式,代码如下: /// <summary> /// Json.net默认转换设置 / ...
- mcelog用法详解
手动启动mcelog方法: # mcelog --daemon Run mcelog in daemon mode, waiting for errors from the kernel. 后台服务启 ...
- 二、selenium 安装
selenium的安装所需要的环境: 1.浏览器的安装Firefox 2.JDK的安装(Java开发基础类库)eclipse 一个开发源代码的工具 3.selenium sever 下载.网络状况监视 ...