Yahoo India Web Search

Search results

  1. I am trying to find the duplicate values in an array. When a number is duplicated once like (25,25) program correctly prints 25 once but when a number duplicated twice like (12,12,12) program prints 12 three times while it should print it once.

  2. Dec 14, 2023 · Input: {2, 10,10, 100, 2, 10, 11,2,11,2} Output: 2 10 11. Input: {5, 40, 1, 40, 100000, 1, 5, 1} Output: 5 40 1. Note: The duplicate elements can be printed in any order. Simple Approach: The idea is to use nested loop and for each element check if the element is present in the array more than once or not.

  3. C program to print the duplicate elements of an array. In this program, we need to print the duplicate elements present in the array. This can be done through two loops. The first loop will select an element and the second loop will iteration through the array by comparing the selected element with other elements.

  4. Find the Duplicate Number - Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number.

  5. May 7, 2024 · Given an array of n elements that contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these repeating numbers in O (n) and use only constant memory space.

  6. Apr 13, 2024 · Given an array arr [] containing n integers where each integer is between 1 and (n-1) (inclusive). There is only one duplicate element, find the duplicate element in O (n) time complexity and O (1) space.

  7. Jun 26, 2017 · Take a input from user in an Array of a size N and print the total number of duplicate elements (The elements which occur two or more times). Input Format: The first line contains N. The second line contains the N positive integer separated by a space. Output Format: Count of duplicate elements.

  8. Oct 26, 2012 · Algorithm to find the duplicate numbers in an array ---Fastest Way. I need the fastest and simple algorithm which finds the duplicate numbers in an array, also should be able to know the number of duplicates. Eg: if the array is {2,3,4,5,2,4,6,2,4,7,3,8,2}

  9. C Program to Find Duplicate Elements in an Array. The below program is applicable on any array which can be a sorted or an unsorted array. Here we will create a temporary array of similar length, traverse through the original array, and if the repeated element is found then insert it in the temporary array.

  10. Sep 12, 2016 · Find the Duplicate Number. Description. Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number. You must solve the problem without modifying the array nums and uses only constant extra space. Example 1: