diff --git a/c/duplicatesInArray.cpp b/c/duplicatesInArray.cpp deleted file mode 100644 index ee814bfb..00000000 --- a/c/duplicatesInArray.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -int main() { - int arr[] = {4, 2, 7, 2, 1, 8, 7, 6, 5, 3}; - int n = sizeof(arr) / sizeof(arr[0]); - - std::unordered_set seen; - bool hasDuplicates = false; - - std::cout << "Duplicate elements in the array: "; - for (int i = 0; i < n; i++) { - if (seen.find(arr[i]) != seen.end()) { - if (hasDuplicates) { - std::cout << ", "; - } - std::cout << arr[i]; - hasDuplicates = true; - } else { - seen.insert(arr[i]); - } - } - - if (!hasDuplicates) { - std::cout << "No duplicates found."; - } - - std::cout << std::endl; - - return 0; -}