CJCoding With Joseph
15free / daySign inCreate account

Use 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
Topics
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.