Код: Выделить всё
vector getPairs(vector& arr) {
sort(arr.begin(), arr.end());
vector vec1;
int n = arr.size();
for (int i = 0; arr[i] < 0; i++) {
for (int j = n; arr[j] > 0; j--) {
if (arr[i] + arr[j] == 0) {
// now i am stuck here, i don't know how to add
// a vector to the vector and also how to return it.
// Will this code create the problem of double inputs?
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... rj-such-th
Мобильная версия