1. 程式人生 > >Leetcode:11- Container With Most Water

Leetcode:11- Container With Most Water

rms mos 谷歌 nat etc 翻譯 至少 leet each

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.

谷歌翻譯拉過來:

給定n個非負整數a1,a2,...,an,其中每個代表坐標(i,ai)處的一個點。 繪制n條垂直線,使得線i的兩個端點處於(i,ai)和(i,0)處。 找到兩條線,它們與x軸一起形成一個容器,使得容器包含最多的水。

註意:不傾斜容器,n至少為2。

題意:

Leetcode:11- Container With Most Water