Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Code shared from the Rust Playground
fn minimalNumberOfCoins(coins: Vec<i32>, price: i32) -> i32 {
let mut dp = vec![100; (price + 1) as usize];
dp[0] = 0;
for coin in &coins {
for target in coin..price {
dp[price as usize] = min(1 + dp[(price - coin) as usize], dp[(price) as usize])
return dp[price as usize];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.