|
| 1 | +# [Container With Most Water][title] |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +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. |
| 6 | + |
| 7 | +Note: You may not slant the container and *n* is at least 2. |
| 8 | + |
| 9 | +**Tags:** Array, Two Pointers |
| 10 | + |
| 11 | + |
| 12 | +## 思路 |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +```java |
| 17 | + |
| 18 | +``` |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +## 结语 |
| 23 | + |
| 24 | +如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[awesome-java-leetcode][ajl] |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +[title]: https://leetcode.com/problems/container-with-most-water |
| 29 | +[ajl]: https://github.com/Blankj/awesome-java-leetcode |
0 commit comments