Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Find duplicated values in a list
//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) { var values = new [] { 9, 7, 2, 6, 7, 3, 8, 2 }; var sorted = values.ToList(); sorted.Sort(); for (var index = 1; index < sorted.Count; index++) { var previous = sorted[index - 1]; var current = sorted[index]; if (current == previous) Console.WriteLine(string.Format("duplicated value: {0}", current)); } } } }
run
|
edit
|
history
|
help
0
bc160401882
Recur5
z
Project Euler No 2
SceneGraph Interviewee Task
List<Action>()
GetChange
checker
The Code Garage
Round Program