mirror of
https://github.com/krahets/hello-algo.git
synced 2026-05-04 01:23:29 +08:00
build
This commit is contained in:
@@ -381,8 +381,8 @@ $$
|
||||
// 循环贪心选择,直至两板相遇
|
||||
while (i < j) {
|
||||
// 更新最大容量
|
||||
val cap = (min(ht[i].toDouble(), ht[j].toDouble()) * (j - i)).toInt()
|
||||
res = max(res.toDouble(), cap.toDouble()).toInt()
|
||||
val cap = min(ht[i], ht[j]) * (j - i)
|
||||
res = max(res, cap)
|
||||
// 向内移动短板
|
||||
if (ht[i] < ht[j]) {
|
||||
i++
|
||||
|
||||
Reference in New Issue
Block a user