comefrom: <awangdev>Cracking the Safe_1.java
code: public String crackSafe(int n, int k) {
          
          Set<String> set = new HashSet<>();
          StringBuffer sb = new StringBuffer();
          for (int i = 0; i < n; i++) sb.append("0");
          set.add(sb.toString());
          
          for (int i = 0; i < Math.pow(k, n); i++) {
              String tail = sb.substring(sb.length() - n + 1); 
              for (int j = k - 1; j >= 0; j--) {
                  String newStr = tail + j;
                  if (!set.contains(newStr)) {
                      set.add(newStr);
                      sb.append(j);
                      break;
                  }
              }
          }
          
          return sb.toString();
      }
masked: public String var_0 ( int var_1 , int var_2 ) {
    Set < String > var_3 = new HashSet < > ( ) ;
    StringBuffer var_4 = new StringBuffer ( ) ;
    for ( int var_5 = 0 ;
    var_5 < var_1 ;
    var_5 ++ ) var_4 . append ( "0" ) ;
    var_3 . add ( var_4 . toString ( ) ) ;
    for ( int var_5 = 0 ;
    var_5 < Math . pow ( var_2 , var_1 ) ;
    var_5 ++ ) {
      String var_6 = var_4 . substring ( var_4 . length ( ) - var_1 + 1 ) ;
      for ( int var_7 = var_2 - 1 ;
      var_7 >= 0 ;
      var_7 -- ) {
        String var_8 = var_6 + var_7 ;
        if ( ! var_3 . contains ( var_8 ) ) {
          var_3 . add ( var_8 ) ;
          var_4 . append ( var_7 ) ;
          break ;
        }
      }
    }
    return var_4 . toString ( ) ;
  }
  