(String tiles)
| 2 | class Solution { |
| 3 | int len; |
| 4 | public int numTilePossibilities(String tiles) { |
| 5 | len = tiles.length(); |
| 6 | boolean used[] = new boolean[len]; |
| 7 | HashSet<String> set = new HashSet<>(); |
| 8 | backtrack(tiles, used, set, ""); |
| 9 | return set.size() - 1; |
| 10 | } |
| 11 | public void backtrack(String tiles, boolean used[], HashSet<String> set, String cur){ |
| 12 | if(set.contains(cur)) return; |
| 13 | set.add(cur); |