This commit is contained in:
akshitgautam42 2023-11-28 20:53:51 +05:30
parent 569db57eff
commit 3093615013
2 changed files with 4 additions and 3 deletions

View File

@ -11,7 +11,7 @@
// Execute `rustlings hint hashmaps1` or use the `hint` watch subcommand for a // Execute `rustlings hint hashmaps1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::collections::HashMap; use std::collections::HashMap;

View File

@ -11,8 +11,7 @@
// //
// Make me pass the tests! // Make me pass the tests!
// //
// Execute `rustlings hint hashmaps2` or use the `hint` watch subcommand for a
// hint.
@ -46,6 +45,8 @@ fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
basket.insert(fruit,1); basket.insert(fruit,1);
} }
} }
// Calculate the total count of fruits
let total_count: u32 = basket.values().sum();
let total_count:u32 = basket.values().sum(); let total_count:u32 = basket.values().sum();
if total_count <=11{ if total_count <=11{