pofk_algorithm 0.0.3

A collection of efficient algorithms implemented in Rust for real-world projects.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use pofk_algorithm::dp_algorithms::coin_change::coin_change;

#[test]
fn test_coin_change_large() {
    let coins = vec![1, 2, 5, 10, 20, 50];
    let amount = 1000;
    let result = coin_change(&coins, amount);
    assert!(result > 0);
    // Impossible case
    let coins = vec![7, 13];
    let amount = 5;
    assert_eq!(coin_change(&coins, amount), -1);
}