11-container-with-most-water
存水最多的容器
解体思路
这题想法式我们给两个索引先分别指向开头和末尾, 再去计算两个索引间的最大的存水量与最大存水量判断, 然后再去判断下索引位置的高度,低的那一面往对方靠近,以此类推直到两方索引相等
go解法
1 | func maxArea(height []int) int { |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment