1
1
// hashmaps2.rs
2
-
3
2
// A basket of fruits in the form of a hash map is given. The key
4
3
// represents the name of the fruit and the value represents how many
5
- // of that particular fruit is in the basket. You have to put *MORE
6
- // THAN 11* fruits in the basket. Three types of fruits - Apple (4),
7
- // Mango (2) and Lychee (5) are already given in the basket. You are
8
- // not allowed to insert any more of these fruits!
4
+ // of that particular fruit is in the basket.
5
+ // Three types of fruits - Apple (4), Mango (2) and Lychee (5) are already given in the basket.
6
+ // You must add fruit to the basket so that there is at least
7
+ // one of each kind and more than 11 in total.
8
+ // You are not allowed to insert any more of these fruits!
9
9
//
10
10
// Make me pass the tests!
11
11
//
@@ -34,8 +34,8 @@ fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
34
34
] ;
35
35
36
36
for fruit in fruit_kinds {
37
- // TODO: Put new fruits if not already present. Note that you
38
- // are not allowed to put any type of fruit that's already
37
+ // TODO: Insert new fruits if they are not already present in the basket.
38
+ // Note that you are not allowed to put any type of fruit that's already
39
39
// present!
40
40
}
41
41
}
@@ -44,6 +44,7 @@ fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
44
44
mod tests {
45
45
use super :: * ;
46
46
47
+ // Don't modify this function!
47
48
fn get_fruit_basket ( ) -> HashMap < Fruit , u32 > {
48
49
let mut basket = HashMap :: < Fruit , u32 > :: new ( ) ;
49
50
basket. insert ( Fruit :: Apple , 4 ) ;
0 commit comments