So here is my array.
double[] testArray = new double[10];
// will generate a random numbers from 1-20, too lazy to write the code
I want to
use a hashset to add members to, then check if there a previous occurrence of current member
public bool ContainsDuplicate(double[] nums)
{
int size = nums.Length;
HashSet set1 = new HashSet();
for (int i = 0; i < size; i++)
{
if (set1.Contains(nums[i]))
{
return true;
}
else
{
set1.Add(nums[i]);
}
}
return false;
}