sort by the distance between pairs c 2b 2b

Solutions on MaxInterview for sort by the distance between pairs c 2b 2b by the best coders in the world

showing results for - "sort by the distance between pairs c 2b 2b"
Lorenzo
15 Mar 2020
1sort(begin(data), end(data),
2     [](pair<int, int> const& a, pair<int, int> const& b)
3{
4     return abs(a.first-a.second)<abs(b.first-b.second);
5});
6