Core Beginner
05 Collections
Work with the two collections you'll reach for most: find a maximum safely, then tally word frequencies.
Return the largest element, or None if empty, in max.
Hints
Iteratorhas a built-inmax(), and it already returns anOption.- A slice's
iter()yields&i32;.copied()turns them intoi32.
Reveal solution
fn max(v: &[i32]) -> Option<i32> {
v.iter().copied().max()
}