mirror of
https://github.com/krahets/hello-algo.git
synced 2026-09-24 23:36:34 +08:00
Many bug fixes and improvements (#1270)
* Add Ruby and Kotlin icons Add the avatar of @curtishd * Update README * Synchronize zh-hant and zh versions. * Translate the pythontutor blocks to traditional Chinese * Fix en/mkdocs.yml * Update the landing page of the en version. * Fix the Dockerfile * Refine the en landingpage * Fix en landing page * Reset the README.md
This commit is contained in:
@@ -19,8 +19,8 @@ fun maxCapacity(ht: IntArray): Int {
|
||||
// 迴圈貪婪選擇,直至兩板相遇
|
||||
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