Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kotlin codes for the chapter of greedy #1103

Merged
merged 8 commits into from
Mar 3, 2024
Prev Previous commit
Update max_product_cutting.kt
  • Loading branch information
curtishd authored Mar 3, 2024
commit 0eae0242f81256dcf91de710d21e0aa74376bc53
3 changes: 1 addition & 2 deletions codes/kotlin/chapter_greedy/max_product_cutting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ fun maxProductCutting(n: Int): Int {
return 3.0.pow(a.toDouble()).toInt() * 2 * 2
}
// 当余数为 0 时,不做处理
// 当余数为 0 时,不做处理
return 3.0.pow(a.toDouble()).toInt()
}

Expand All @@ -37,4 +36,4 @@ fun main() {
// 贪心算法
val res = maxProductCutting(n)
println("最大切分乘积为 $res")
}
}