leetcode_11. Container With Most Water ? 待解决

来源:互联网 发布:热门小说大全软件 编辑:程序博客网 时间:2024/06/06 15:18

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 and n is at least 2.

提示:提交代码后,需要用简洁的语言解释一下代码思路~ 谢谢

历史题目和总结见公众号「每日一道算法题」

https://leetcode.com/problems/container-with-most-water/description/

思路