Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b1d28c2

Browse filesBrowse files
committed
commit
1 parent 9304ece commit b1d28c2
Copy full SHA for b1d28c2

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎[0011][Container With Most Water]/src/Solution.java

Copy file name to clipboardExpand all lines: [0011][Container With Most Water]/src/Solution.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public class Solution {
2020
*
2121
* 解题思路:
2222
* 使用贪心算法,
23-
* 1.首先假设我们找到能取最大容积的纵线为 i, j (假定i<j),
23+
* 1.首先假设我们找到能取最大容积的纵线为 i, j (假定i < j),
2424
* 那么得到的最大容积 C = min( ai , aj ) * ( j- i) ;
2525
*
2626
* 2.下面我们看这么一条性质:
27-
* ①: 在 j 的右端没有一条线会比它高!假设存在 k |( j<k && ak > aj) ,
27+
* ①: 在 j 的右端没有一条线会比它高!假设存在 k |( j < k && ak > aj) ,
2828
* 那么 由 ak > aj,所以 min(ai, aj, ak) =min(ai, aj) ,
2929
* 所以由i, k构成的容器的容积C' = min(ai, aj) * (k - i) > C,
3030
* 与C是最值矛盾,所以得证j的后边不会有比它还高的线;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.