Lambda as a Predicate (count_if)
mediumQuestion 193Use a lambda together with the STL algorithm std::count_if. Write int countGreater(const vector<int>& nums, int threshold) that returns how many elements are strictly greater than threshold, using count_if with a lambda that captures threshold. Include <algorithm>.
Do NOT write a main function.
Expected output
2 4
= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
Lambda Functions
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.