MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / find_minimum_change

Function find_minimum_change

src/greedy/minimum_coin_change.rs:170–192  ·  view source on GitHub ↗

# Minimum Coin Change (Greedy Algorithm) This module implements a greedy algorithm to find the minimum number of coins needed to make change for a given amount using specified denominations. ## Algorithm The greedy approach works by always selecting the largest denomination possible at each step. While this approach doesn't guarantee an optimal solution for all denomination systems, it works co

(denominations: &[i32], value: i32)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 10

test_large_amountFunction · 0.85
test_zero_valueFunction · 0.85
test_negative_valueFunction · 0.85
test_single_denominationFunction · 0.85
test_exact_denominationFunction · 0.85
test_empty_denominationsFunction · 0.85
test_usd_currencyFunction · 0.85

Calls 3

pushMethod · 0.80
is_emptyMethod · 0.45
cmpMethod · 0.45

Tested by 10

test_large_amountFunction · 0.68
test_zero_valueFunction · 0.68
test_negative_valueFunction · 0.68
test_single_denominationFunction · 0.68
test_exact_denominationFunction · 0.68
test_empty_denominationsFunction · 0.68
test_usd_currencyFunction · 0.68