About 6,640 results
Open links in new tab
  1. Find duplicate elements in an array - GeeksforGeeks

    Dec 19, 2024 · Given an array of n integers. The task is to find all elements that have more than one occurrences. The output should only be one occurrence of a number irrespective of the …

  2. More elegant way to check for duplicates in C++ array?

    Feb 4, 2013 · vector <int> numArray = { 1,2,1,4,5 }; unordered_map<int, bool> hasDuplicate; bool flag = false; for (auto i : numArray) { if (hasDuplicate[i]) { flag = true; break; } else …

  3. Find the two repeating elements in a given array - GeeksforGeeks

    Mar 4, 2025 · Find the sum and product of repeating elements using the differences between the array’s sum/product and the expected sum/product of the first N natural numbers. Solve the …

  4. Repeating Elements in an array using C++ - PrepInsta

    Here, in this page we will discuss two different methods to print the repeated elements of the given input array. These two methods are : Method 1 : Using loops; Method 2 : Using Map. …

  5. c++ - repeating elements in a given array - Stack Overflow

    May 25, 2021 · It sounds like you may need to learn how to use a debugger to step through your code. With a good debugger, you can execute your program line by line and see where it is …

  6. Find the first repeating element in an array of integers

    Nov 18, 2024 · Given an array of integers arr [], The task is to find the index of first repeating element in it i.e. the element that occurs more than once and whose index of the first …

  7. Write a C++ Program to Find Duplicate Elements in an Array

    Dec 27, 2016 · Here is source code of the C++ Program to Find Duplicate Elements in an Array. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. …

  8. C++ : Find the two repeating elements in a array of integers - w3resource

    Apr 12, 2025 · Find Two Repeating Elements in Array. Write a C++ program to find the two repeating elements in a given array of integers. Sample Solution: C++ Code : int nums[] = {1, …

  9. How to check if an array has any duplicates? - Stack Overflow

    Jun 9, 2016 · You can use this method: // sort a copy of the array with the algorithm you like the most and then... bool duplicates = false; for(i = 0; i < 7; i++) { if (array[i] == array[i+1]) { …

  10. Find Repeating Element in Array| Leetcode #287 - CodeKyro

    Apr 27, 2021 · Below is the C++ implementation to find repeating element in Array using Brute Force. //Brute force approch to find repeating element in array for(int i =0;i<n;i++) { for(int j = …

Refresh