Answers for "Sort by the distance between pairs c++"

C++
0

Sort by the distance between pairs c++

sort(begin(data), end(data),
     [](pair<int, int> const& a, pair<int, int> const& b)
{
     return abs(a.first-a.second)<abs(b.first-b.second);
});
Posted by: Guest on March-27-2021

Code answers related to "Sort by the distance between pairs c++"

Browse Popular Code Answers by Language