You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
miguel 1aa3484757 fix(rust-piscine) adding a new file for code editor to use 6 months ago
..
README.md docs(smallest): specify what to do when the hashmap is empty 1 year ago
main.rs fix(rust-piscine) adding a new file for code editor to use 6 months ago

README.md

smallest

Instructions

Create a function named smallest that gets the smallest number in the HashMap.

If the HashMap is empty, return the maximum i32.

Expected Function

pub fn smallest(h: HashMap<&str, i32>) -> i32 {
}

Usage

Here is a program to test your function.

use std::collections::HashMap;
use smallest::smallest;

fn main() {

    let mut hash = HashMap::new();
    hash.insert("Cat", 122);
    hash.insert("Dog", 333);
    hash.insert("Elephant", 334);
    hash.insert("Gorilla", 14);

    println!("The smallest of the elements in the HashMap is {}", smallest(hash));
}

And its output

$ cargo run
The smallest of the elements in the HashMap is 14
$

Notions