11. Container With Most Water
Difficulty: Medium
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.
求从数组中,选两个高作为边界,形成一个桶,能装的水最多
如 [6,1,1,4,3,6] 结果是30
My Solution
1 | class Solution { |


