题目链接:https://leetcode-cn.com/problems/contains-duplicate/
题目如下:
class Solution {
public boolean containsDuplicate(int[] nums) {
HashSet<Integer> hashset=new HashSet<Integer>();
int len=nums.length;
for(int i=0;i<len;i++){
if(hashset.contains(nums[i])) return true;
else hashset.add(nums[i]);
}
return false;
}
}