Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace GerryTutor
- {
- class Program
- {
- static List<int> NonRepeat(int[] arr)
- {
- HashSet<int> set = new HashSet<int>();
- foreach (var item in arr)
- {
- set.Add(item);
- }
- return set.ToList();
- }
- static void Main(string[] args)
- {
- int[] arr = { 8, 10, 31, 19, 8, 8, 31, 10 };
- List<int> l = NonRepeat(arr);
- foreach (var item in l)
- {
- Console.WriteLine(item);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement