use a dictionary/map/hashtable and check if it exists in the dictionary before re-adding it.
if (numberMap.count(newNumber) == 1) continue;
you are reiventing the wheel as well
Обсуждают сегодня