leetcode - Container With Most Water
来源:互联网 发布:手机语音聊天软件 编辑:程序博客网 时间:2024/06/08 15:03
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) 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.
解析: i,j 两点之间,假设i点高度小于j点高度,那他们两点间的容量c=(j - i )* i的高度 ,任意i ,j 之间的一点k 与 i 点组成的水桶容量一定小于i,j之间的容量c。所以i点 与其他点之间的容量就不用算了。
Note: You may not slant the container.
解析: i,j 两点之间,假设i点高度小于j点高度,那他们两点间的容量c=(j - i )* i的高度 ,任意i ,j 之间的一点k 与 i 点组成的水桶容量一定小于i,j之间的容量c。所以i点 与其他点之间的容量就不用算了。
0 0
- LeetCode: Container With Most Water
- [LeetCode]Container With Most Water
- LeetCode Container With Most Water
- LeetCode: Container With Most Water
- [Leetcode] Container With Most Water
- Leetcode: Container With Most Water
- [LeetCode] Container With Most Water
- LeetCode Container With Most Water
- [Leetcode] Container With Most Water
- [LeetCode]Container With Most Water
- LeetCode-Container With Most Water
- Container With Most Water leetcode
- LeetCode - Container With Most Water
- LeetCode: Container With Most Water
- Leetcode: Container With Most Water
- 【LeetCode】Container With Most Water
- Leetcode: Container With Most Water
- LeetCode:Container With Most Water
- android中的网络编程
- 一,Spring初探
- Linux设备驱动之Ioctl控制
- Duplicate Emails
- App升级
- leetcode - Container With Most Water
- 微信公众平台开发者模式和编辑模式有什么用
- 在spring中获取代理对象代理的目标对象工具类
- Django学习____Model
- 关于oracle with as用法
- 欢迎使用CSDN-markdown编辑器
- 国际标准协议之BNF与ABNF
- Ajax
- Android MediaCodec实现摄像头数据硬编解码全过程