Namara

Code daily. Without assist.

2026-08-20

max_of.rs

fn max_of(nums: &[i32]) -> Option<i32> {
    // write this
}

Implement max_of: return the largest value in nums, or None if it's empty.

Reference
fn max_of(nums: &[i32]) -> Option<i32> {
    nums.iter().copied().max()
}

Iterator::max() already returns None on an empty iterator, so there's no separate empty check to write.