sort(a.begin(), a.end(), [] (int a, int b) {
return a > b;
});
what does the 3rd parameter in this mean
source: solution of problem c in Codeforces Round #764 (Div. 3) Editorial - Codeforces
sort(a.begin(), a.end(), [] (int a, int b) {
return a > b;
});
what does the 3rd parameter in this mean
source: solution of problem c in Codeforces Round #764 (Div. 3) Editorial - Codeforces
It’s the (at the time of writing) the “(3)” form from here:
https://en.cppreference.com/w/cpp/algorithm/sort
i.e. sort where the third parameter is the comparator, given here as a lambda.
Equivalent to:
sort(a.begin(), a.end(), std::greater<>());
what does the [] mean here???
thanks for reply.
Reference to a function, ig.