using System.Collections.Generic;
public static void Main()
int[] arr1 = new int[]{ 7, 7, 8, 8, 9, 1, 1, 4, 2, 2 };
int[] distinctArr=RemoveDuplicates(arr1);
foreach(var i in distinctArr){
public static int[] RemoveDuplicates(int[] arr)
HashSet<int> newArr = new HashSet<int>();
List<int> list = new List<int>();