Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 790 Bytes

File metadata and controls

49 lines (33 loc) · 790 Bytes

Iterator adaptors

Example

Execute the following command to run ./solutions/examples/iter_adaptors.rs

cargo run --example iter_adaptors

Exercises

Exercises are in ./exercises/src/lib.rs

Exercise 1

pub fn filter_non_zero(v: Vec<u32>) -> Vec<u32> {
    todo!();
}

Return a vector where each element is greater than 0.

Exercise 2

pub fn to_string(v: Vec<&str>) -> Vec<String> {
    todo!();
}

Convert vector of &str into a vector of String.

Exercise 3

pub fn to_hash_map(v: Vec<(String, u32)>) -> HashMap<String, u32> {
    todo!();
}

Convert a vector of (String, u32) into a HashMap<String, u32>.

Test

cargo test