c++ sort numbers by magnitude/absolute value
// sort numbers by their magnitude value
bool sortByAbsolute(int a, int b) {
return abs(a) < abs(b);
}
void find(std::vector<int> &nums, std::vector<int> &sorted) {
std::sort(nums.begin(), nums.end(), sortByAbsolute);
}