import java.util.*;
public class Solution {
HashSet<String> res = new HashSet<>();
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param s string字符串
* @return string字符串一维数组
*/
public String[] generatePermutation (String s) {
// write code here
process(s, 0, "");
return res.toArray(new String[0]);
}
public void process(String str, int start, String tmp) {
String copyStr = new String(tmp);
res.add(copyStr);
if (start >= str.length()) {
return;
}
for (int i = start; i < str.length(); i++) {
String tmpStr = new String(tmp);
tmpStr += str.charAt(i);
process(str, i + 1, tmpStr);
}
}
}