Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Find duplicates in a given integer array
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { int [] arr = new int []{1,3,3,4,4,5,6,7,8,8,9}; findduplicates(arr); } public static void findduplicates(int[] a) { Dictionary<int,int> dict = new Dictionary<int,int>(); dict.Add(a[0],1); for(int i=1; i< a.Length; i++) { if(dict.ContainsKey(a[i])) { dict[a[i]]++; } else { dict.Add(a[i],1); } } foreach(KeyValuePair<int,int> dic in dict) { if(dic.Value >1) Console.WriteLine(dic.Key); } } } }
run
|
edit
|
history
|
help
0
https://www.compliantmechanisms.byu.edu/profile/new-free-robux-generator-2022/profile
first case
FirstNonRepeatCharOfString
Regex fórum 01
QuickSort
program
Intuit // C# // listing_4.5 (Math. /Pow /Sin)
Is String a Palindrome
Code challenge: Integer Comparison - Overkill - Composite Function
Fórum SO ➡ Merging 2 lists by Name and adding their Values, using LINQ ♦