<gouthampradhan>backtracking_SubsetsII_1.java
public List<List<Integer>> subsetsWithDup(int[] nums) {
    List<List<Integer>> result = new ArrayList<>();
    result.add(new ArrayList<>()); 
    int start = 0, newStart = 0;
    Arrays.sort(nums);
    for (int i = 0, l = nums.length; i < l; i++) {
      newStart = result.size();
      if (i == 0 || nums[i] != nums[i - 1]) {
        start = 0;
      }
      for (int j = start, resLen = result.size(); j < resLen; j++) {
        List<Integer> newList = new ArrayList<>(result.get(j));
        newList.add(nums[i]);
        result.add(newList);
      }
      start = newStart;
    }
    return result;
  }
public List < List < Integer >> var_2 ( int [ ] var_3 ) {
  List < List < Integer >> var_5 = new ArrayList < > ( ) ;
  var_5 . add ( new ArrayList < > ( ) ) ;
  int var_8 = 0 , var_9 = 0 ;
  Arrays . sort ( var_3 ) ;
  for ( int var_12 = 0 , var_14 = var_3 . length ;
  var_12 < var_14 ;
  var_12 ++ ) {
    var_9 = var_5 . size ( ) ;
    if ( var_12 == 0 || var_3 [ var_12 ] != var_3 [ var_12 - 1 ] ) {
      var_8 = 0 ;
    }
    for ( int var_17 = var_8 , var_18 = var_5 . size ( ) ;
    var_17 < var_18 ;
    var_17 ++ ) {
      List < Integer > var_20 = new ArrayList < > ( var_5 . get ( var_17 ) ) ;
      var_20 . add ( var_3 [ var_12 ] ) ;
      var_5 . add ( var_20 ) ;
    }
    var_8 = var_9 ;
  }
  return var_5 ;
}
