<awangdev>219. Contains Duplicate II_1.java
public boolean containsNearbyDuplicate(int[] nums, int k) {
        if (nums == null || nums.length == 0 || k <= 0) {
            return false;
        }
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
            if (i > k) {
                set.remove(nums[i - k - 1]);
            }
            if (!set.add(nums[i])) {
                return true;
            }
        }
        return false;
    }
public boolean var_0 ( int [ ] var_1 , int var_2 ) {
  if ( var_1 == null || var_1 . length == 0 || var_2 <= 0 ) {
    return false ;
  }
  Set < Integer > var_9 = new HashSet < > ( ) ;
  for ( int var_10 = 0 ;
  var_10 < var_1 . length ;
  var_10 ++ ) {
    if ( var_10 > var_2 ) {
      var_9 . remove ( var_1 [ var_10 - var_2 - 1 ] ) ;
    }
    if ( ! var_9 . add ( var_1 [ var_10 ] ) ) {
      return true ;
    }
  }
  return false ;
}
