📅  最后修改于: 2022-03-11 14:44:46.605000             🧑  作者: Mango
// sort numbers by their magnitude value
bool sortByAbsolute(int a, int b) {
return abs(a) < abs(b);
}
void find(std::vector &nums, std::vector &sorted) {
std::sort(nums.begin(), nums.end(), sortByAbsolute);
}