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_1 = new HashSet < > ( ) ;
    List < Integer > var_2 = new ArrayList < > ( ) ;
    int var_3 = 0 ;
    Arrays . sort ( var_0 ) ;
    int var_4 = var_0 [ 0 ] ;
    int var_5 = var_0 [ var_0 . length - 1 ] ;
    int var_6 = var_5 - var_4 + 1 ;
    for ( int var_7 : var_0 ) {
      if ( var_1 . contains ( var_7 ) ) var_2 . add ( var_7 ) ;
      else var_1 . add ( var_7 ) ;
    }
    var_6 -= var_1 . size ( ) ;
    for ( int var_8 = var_4 + 1 ;
    var_8 < var_5 ;
    var_8 ++ ) {
      if ( var_6 == 0 || var_2 . size ( ) == 0 ) break ;
      if ( ! var_1 . contains ( var_8 ) && var_8 > var_2 . get ( 0 ) ) {
        var_3 += var_8 - var_2 . get ( 0 ) ;
        var_6 -- ;
        var_2 . remove ( 0 ) ;
      }
    }
    if ( var_2 . size ( ) == 0 ) return var_3 ;
    while ( var_2 . size ( ) != 0 ) {
      var_5 += 1 ;
      var_3 += var_5 - var_2 . get ( 0 ) ;
      var_2 . remove ( 0 ) ;
    }
    return var_3 ;
  }
  