MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / numTilePossibilities

Method numTilePossibilities

LetterTilePossibilities-1.java:4–10  ·  view source on GitHub ↗
(String tiles)

Source from the content-addressed store, hash-verified

2class 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);

Callers

nothing calls this directly

Calls 1

backtrackMethod · 0.95

Tested by

no test coverage detected