Given an array {1, 2, 3, 1, 5, 6,} the output should be
{1}
public void FirstRepeatingCahrecter(int[] arr){
int min=-1;
HashSet hset = new HashSet();
for(int i=arr.Length-1;i>0;iβ){
if(hset.Contains(arr[i]))
min=i;
else
hset.add(arr[i]);
}
if(min!=-1){
Console.WriteLine(βThe first repeating charecter is:β+ arr[min]);
}else
Console.WriteLine(βThere is not repeating charecter in the arrayβ);
}