LeetCode--Container With Most Water
来源:互联网 发布:轻量 linux 桌面 编辑:程序博客网 时间:2024/04/19 15:24
需要对题目进行分析,最好在纸上画一下场景,可以得出O(n)解决方案,也有n方解决方案,当然比较简单,以下是o(n)方案。
func maxArea(height []int) int { max := 0 left := 0 right := len(height) - 1 for left < right { var area int if height[left] < height[right] { area = (right - left) * height[left] left++ } else { area = (right - left) * height[right] right-- } if area > max { max = area } } return max}
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
- 转 angularjs controller的两种写法
- Android MediaCodec 资料
- jedis-JAVA操作Redis
- PVANET: 用于实时目标检测的深但轻量级神经网络
- 二叉树(一)
- LeetCode--Container With Most Water
- 在线linux 系统初步取证
- 二叉树(二)
- Android 获取内外置存储卡方法
- 规划问题求解的理论---线性代数
- C++、delphi、python Quick_Sort实现
- 二叉树(三)
- 简单记录LaTex的入门经过
- CSS3 几步即可实现loading动画效果