You have given a list of integers.
- Use a vector and return the mean (the average value).
- Return the median (when sorted, the value in the middle position).
- Return the mode (the value that occurs most often; a hash map will be helpful here) of the list.
Convert strings to pig latin (Keep in mind the details about UTF-8 encoding!).
-> The first consonant of each word is moved to the end of the word and "ay" is added:
"first" becomes "irst-fay"
-> Words that start with a vowel have "hay" added to the end instead:
"apple" becomes "apple-hay"
Using a hash map
and vectors
, create a text interface to allow a user to add employee names to a department in a company.
- For example, "Add Sally to Engineering" or "Add Amir to Sales."
- Then let the user retrieve a list of all people in a department
- Or all people in the company by department, sorted alphabetically.
Exercises are copied from the original Rust book here.