We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 029ca64 commit bfa1243Copy full SHA for bfa1243
0219-contains-duplicate-ii/0219-contains-duplicate-ii.java
@@ -1,5 +1,8 @@
1
class Solution {
2
public boolean containsNearbyDuplicate(int[] nums, int k) {
3
+ if (nums.length == 0)
4
+ return false;
5
+
6
Set<Integer> set = new HashSet<>();
7
for (int i = 0; i < nums.length; i++) {
8
if (i > k) {
0 commit comments