f*****t 发帖数: 13 | 1 Container With Most Water
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.
下面是run完我的function后的一个test case:
Showing the first failed test case.
input output expected
[1,2,4,3] 6 4
不太明白为什么expected应该是4? | x****8 发帖数: 127 | 2 take 2 and 3, width 2,
2*2 = 4
point
together
【在 f*****t 的大作中提到】 : Container With Most Water : 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. : 下面是run完我的function后的一个test case: : Showing the first failed test case. : input output expected
| f*****t 发帖数: 13 | 3 谢谢!
【在 x****8 的大作中提到】 : take 2 and 3, width 2, : 2*2 = 4 : : point : together
|
|