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
hay
fgtyhi8uy7htr4e3qwcedf
C# Calculator Simple
Timer2 v.1
Sugar
sortowania przez wstawienie
Sandeep Chandra Bose
a
Hi
3