博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Container With Most Water
阅读量:7097 次
发布时间:2019-06-28

本文共 584 字,大约阅读时间需要 1 分钟。

Given n non-negative integers a1a2, ..., an, where each represents a point at coordinate (iai). n vertical lines are drawn such that the two endpoints of line i is at (iai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.

Note: You may not slant the container.

 

Code:

class Solution {public:    int maxArea(vector
&height) { if(height.empty()) return 0; int i=0,j=height.size()-1; int maxCapacity=0; while(i

 

转载于:https://www.cnblogs.com/winscoder/p/3398413.html

你可能感兴趣的文章
PCIE hotplug 调试小结
查看>>
我的友情链接
查看>>
输出二维环形数组中最大子数组和
查看>>
用户调查报告
查看>>
servlet 单例多线程
查看>>
Linux命令模拟Http的get或post请求
查看>>
Navicat使用教程:使用Navicat Query Analyzer优化查询性能(第2部分)
查看>>
mongoDB 在windows平台下安装成系统服务
查看>>
linux学习第八周总结
查看>>
第二次测试题
查看>>
Java 处理异常 9 个最佳实践,你知道几个?
查看>>
Apache 不能列目录解决。
查看>>
如何永久的修改主机名
查看>>
NSSearchPathForDirectoriesInDomains用法(后台缓存)
查看>>
Jqurey 全选和全不选
查看>>
ELK日志收集平台部署
查看>>
软件公司员工辞职、人员流动大是必然
查看>>
勤快的love枫[ZJOI2007]
查看>>
Linux查看系统信息的一些命令及查看已安装软件包的命令
查看>>
poj1417 true liars(并查集 + DP)详解
查看>>