Contains Duplicate
Thu Sep 25 2025 08:28:58 GMT+0000 (Coordinated Universal Time)
Saved by
@Inescn
public boolean containsDuplicate(int[] nums) {
Set<Integer> set = new HashSet<>();
for (int num : nums) {
if (!set.add(num)) {
return true;
}
}
return false;
}
content_copyCOPY
Comments