Skip to main content

Practice ยท 1 of 1

Filter and rank with lambdas

Given the Student struct in the boilerplate, implement std::vector<Student> passing(const std::vector<Student>& students, int cutoff) returning students with score >= cutoff, ordered by score **descending**. Use std::copy_if with a capture-by-value lambda, then std::sort with a comparator lambda.

Difficulty: intermediate

Back to lesson: Practice: Lambda practice