Leed code 11. Container With Most Water
 public int maxArea(int[] height) {
     int left = 0, right = height.length - 1;
     int maxArea = 0;
     while (left < right) {
         maxArea = Math.max(maxArea, Math.min(height[left], height[right])
                 * (right - left));
         if (height[left] < height[right])
             left++;
         else
             right--;
     }
     return maxArea;
 }
Leed code 11. Container With Most Water的更多相关文章
- leetcode 11. Container With Most Water 、42. Trapping Rain Water 、238. Product of Array Except Self 、407. Trapping Rain Water II
		11. Container With Most Water https://www.cnblogs.com/grandyang/p/4455109.html 用双指针向中间滑动,较小的高度就作为当前情 ... 
- Leetcode  11.  Container With Most Water(逼近法)
		11. Container With Most Water Medium Given n non-negative integers a1, a2, ..., an , where each repr ... 
- LeetCode Array Medium 11. Container With Most Water
		Description Given n non-negative integers a1, a2, ..., an , where each represents a point at coordin ... 
- 刷题11. Container With Most Water
		一.题目说明 11.Container With Most Water,这个题目难度是Medium. 二.我的做法 乍一看,简单啊,两个for循环就可以了,我在本地写的. #include<io ... 
- 如何装最多的水? — leetcode 11. Container With Most Water
		炎炎夏日,还是呆在空调房里切切题吧. Container With Most Water,题意其实有点噱头,简化下就是,给一个数组,恩,就叫 height 吧,从中任选两项 i 和 j(i <= ... 
- [leecode]---11.container with most water
		description: Input: [1,8,6,2,5,4,8,3,7]Output: 49 思路1: 从(1,a1)开始向后算面积,需要两层n循环,时间复杂度n2 思路2: 找出数组中最大的数 ... 
- 《LeetBook》leetcode题解(11):Container With Most Water[M] ——用两个指针在数组内移动
		我现在在做一个叫<leetbook>的免费开源书项目,力求提供最易懂的中文思路,目前把解题思路都同步更新到gitbook上了,需要的同学可以去看看 书的地址:https://hk029.g ... 
- LeetCode 11. Container With Most Water (装最多水的容器)
		Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). ... 
- [leetcode]11. Container With Most Water存水最多的容器
		Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). ... 
随机推荐
- Qt 信号槽
			Qt4与Qt5的信号槽有些不同: 1. Qt4的槽函数必须使用slots关键字声明,而Qt5中已经不再需要了,槽函数可以是任何能和信号关联的成员函数. 2. Qt4指定信号函数和槽函数需用SIGNAL ... 
- ansible随记
			先来看一下ansible架构图: 一.官网的语法简单介绍 #选择的主机组 - hosts: webservers #这个是变量 vars: http_port: 80 max_cl ... 
- Haskell语言学习笔记(55)Data.Vector
			Data.Vector Construction Prelude V> import Data.Vector as V Prelude V> V.empty [] Prelude V> ... 
- 扩展C#与元编程(一)
			众所周知,Roslyn project已经开源一年多了.简单的说,Roslyn是:1)用C#/VB写的C#/VB的编译器,以及与IDE集成:2)编译器的功能以API的方式暴露出来(即一组DLL). R ... 
- html资源 链接
			http://m.aicai.com/index.do?agentId=1&vt=5 
- XtraBackup 备份原理
			来着淘宝技术: http://mysql.taobao.org/monthly/2016/03/07/ https://github.com/alibaba/AliSQL 前言 Percona Xtr ... 
- linux的文件类型和权限
			Linux下使用ll或ls -l查看文件的信息 (ll和ls-l的区别:ll会显示出当前目录下的隐藏文件,而ls -l不会) 文件信息分为:文件类型.权限.链接数.所属用户.所属用户组.文件大小. ... 
- cdoj203-Islands             【并查集】
			http://acm.uestc.edu.cn/#/problem/show/203 Islands Time Limit: 30000/10000MS (Java/Others) Memor ... 
- HashMap的hash冲突解决方案
			Hash函数 非哈希表的特点:关键字在表中的位置和它之间不存在一个确定的关系,查找的过程为给定值一次和各个关键字进行比较,查找的效率取决于和给定值进行比较的次数. 哈希表的特点:关键字在表中位置和它之 ... 
- error: In function ‘void* opencv_showimg(void*)’:
			今天这个问题折磨了我一下午,终于知道是为什么了,心酸历程.....赶紧来记录一下 错误: /home/wj/workspace/Loitor_VI_Sensor_SDK_V1./SDK/src/cam ... 
