comefrom: <awangdev>46. Permutations_6.java
code: public List<List<Integer>> permute(int[] nums) {
          List<List<Integer>> rst = new ArrayList<>();
          if (nums == null || nums.length == 0) return rst;
          
          List<Integer> numList = new ArrayList<>();
          for (int num : nums) numList.add(num);
          
          int n = nums.length;
          Queue<List<Integer>> queue = new LinkedList<>();
          queue.offer(new ArrayList<>());
  
          while (!queue.isEmpty()) {
              List<Integer> list = queue.poll();
              if (list.size() == n) {
                  rst.add(new ArrayList<>(list));
                  continue;
              }
              List<Integer> candidates = new ArrayList<>(numList);
              candidates.removeAll(list);
              for (int num : candidates) {
                  list.add(num);
                  queue.offer(new ArrayList<>(list));
                  list.remove(list.size() - 1);
              }
          }
  
          return rst;
      }
masked: public List < List < Integer >> var_0 ( int [ ] var_1 ) {
    List < List < Integer >> var_2 = new ArrayList < > ( ) ;
    if ( var_1 == null || var_1 . length == 0 ) return var_2 ;
    List < Integer > var_3 = new ArrayList < > ( ) ;
    for ( int var_4 : var_1 ) var_3 . add ( var_4 ) ;
    int var_5 = var_1 . length ;
    Queue < List < Integer >> var_6 = new LinkedList < > ( ) ;
    var_6 . offer ( new ArrayList < > ( ) ) ;
    while ( ! var_6 . isEmpty ( ) ) {
      List < Integer > var_7 = var_6 . poll ( ) ;
      if ( var_7 . size ( ) == var_5 ) {
        var_2 . add ( new ArrayList < > ( var_7 ) ) ;
        continue ;
      }
      List < Integer > var_8 = new ArrayList < > ( var_3 ) ;
      var_8 . removeAll ( var_7 ) ;
      for ( int var_4 : var_8 ) {
        var_7 . add ( var_4 ) ;
        var_6 . offer ( new ArrayList < > ( var_7 ) ) ;
        var_7 . remove ( var_7 . size ( ) - 1 ) ;
      }
    }
    return var_2 ;
  }
  