mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-16 16:56:06 +00:00
Fix the content
This commit is contained in:
@@ -12,7 +12,7 @@ fn coin_change_greedy(coins: &[i32], mut amt: i32) -> i32 {
|
||||
// 循环进行贪心选择,直到无剩余金额
|
||||
while amt > 0 {
|
||||
// 找到小于且最接近剩余金额的硬币
|
||||
while coins[i] > amt {
|
||||
while i > 0 && coins[i] > amt {
|
||||
i -= 1;
|
||||
}
|
||||
// 选择 coins[i]
|
||||
|
||||
Reference in New Issue
Block a user