Practice ยท 1 of 1
Incident Repair: The Truncated Report
Incident report: averageOf returned garbage for a one-element report. The broken function divides by v.size() - 1 (a size_t), so an empty/one-element vector underflows the unsigned size. Repair it: return std::nullopt for an empty vector, and the correct mean otherwise.
Difficulty: advanced
Press Submit to check your solution.
Back to lesson: Practice: Practice: Sanitizer-Grade Repairs