水题
题目链接这里
public class Solution {
public boolean containsDuplicate(int[] nums) {
HashSet<Integer> myHashSet=new HashSet<Integer>();
for(int i=0;i<nums.length;i++)
{
if(myHashSet.contains(nums[i]))
{
return true;
}
else
{
myHashSet.add(nums[i]);
}
}
return false;
}
}