comefrom: <qiyuangong>945_Minimum_Increment_to_Make_Array_Unique_1.java
code: public int minIncrementForUnique(int[] A) {
          if (A.length == 0) return 0;
          HashSet<Integer> numSet = new HashSet<>();
          List<Integer> duplicated = new ArrayList<>();
          int res = 0;
          Arrays.sort(A);
          int left  = A[0];
          int right = A[A.length - 1];
          int holes = right - left + 1;
          for (int v: A) {
              if (numSet.contains(v)) duplicated.add(v);
              else numSet.add(v);
          }
          holes -= numSet.size();
          for (int i = left + 1; i < right; i++) {
              if (holes == 0 || duplicated.size() == 0) break;
              if (!numSet.contains(i) && i > duplicated.get(0)) {
                  res += i - duplicated.get(0);
                  holes --;
                  duplicated.remove(0);
              }
          }
          if (duplicated.size() == 0) return res;
          while (duplicated.size() != 0) {
              right += 1;
              res += right - duplicated.get(0);
              duplicated.remove(0);
          } 
          return res;
      }
masked: public int sample_funcname ( int [ ] var_0 ) {
    if ( var_0 . length == 0 ) return 0 ;
    HashSet < Integer > var_5 = new HashSet < > ( ) ;
    List < Integer > var_8 = new ArrayList < > ( ) ;
    int var_9 = 0 ;
    Arrays . sort ( var_0 ) ;
    int var_12 = var_0 [ 0 ] ;
    int var_14 = var_0 [ var_0 . length - 1 ] ;
    int var_15 = var_14 - var_12 + 1 ;
    for ( int var_16 : var_0 ) {
      if ( var_5 . contains ( var_16 ) ) var_8 . add ( var_16 ) ;
      else var_5 . add ( var_16 ) ;
    }
    var_15 -= var_5 . size ( ) ;
    for ( int var_20 = var_12 + 1 ;
    var_20 < var_14 ;
    var_20 ++ ) {
      if ( var_15 == 0 || var_8 . size ( ) == 0 ) break ;
      if ( ! var_5 . contains ( var_20 ) && var_20 > var_8 . get ( 0 ) ) {
        var_9 += var_20 - var_8 . get ( 0 ) ;
        var_15 -- ;
        var_8 . remove ( 0 ) ;
      }
    }
    if ( var_8 . size ( ) == 0 ) return var_9 ;
    while ( var_8 . size ( ) != 0 ) {
      var_14 += 1 ;
      var_9 += var_14 - var_8 . get ( 0 ) ;
      var_8 . remove ( 0 ) ;
    }
    return var_9 ;
  }
  