Skip to content

Commit e3c3e47

Browse files
authored
Update 11.container-with-most-water.md
1 parent f8c1ee0 commit e3c3e47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

problems/11.container-with-most-water.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ for (let i = 0; i < height.length; i++) {
5050
return max;
5151
```
5252

53-
可以解法效率不高,但是可以通过(JS可以通过,Python 不可以,其他语言没有尝试)。那么有没有更优的解法呢?
53+
虽然解法效率不高,但是可以通过(JS可以通过,Python 不可以,其他语言没有尝试)。那么有没有更优的解法呢?
5454

5555
我们来换个角度来思考这个问题,上述的解法是通过两两组合,这无疑是完备的。我们换个角度思考,是否可以先计算长度为 n 的面积,然后计算长度为 n-1 的面积,... 计算长度为 1 的面积。 这样去不断更新最大值呢?很显然这种解法也是完备的,但是似乎时间复杂度还是 $O(n ^ 2)$, 不要着急。
5656

57-
考虑一下,如果我们计算 n-1 长度的面积的时候,是直接直接排除一半的结果的
57+
考虑一下,如果我们计算 n-1 长度的面积的时候,是可以直接排除一半的结果的
5858

5959
如图:
6060

0 commit comments

Comments
 (0)