# Problem Statement You have `n`  `tiles`, where each tile has one letter `tiles[i]` printed on it. Return _the number of possible non-empty sequences of letters_ you can make using the letters printed on those `tiles`. ## Constraints - `1 <= tiles.length <= 7` - `tiles` consists of uppercase English letters. # Solution Due to the low input constraints, it is sufficient to generate all [[Permutation|permutations]] of size `i` from size 1 to the input length. We then add each permutation to a [[Python set|set]], which will remove duplicates. Then simply return the length of this [[Python set|set]]. A more optimized algorithm would use [[backtracking]], but I am not including it here for the sake of simplicity. ```python allPerms = set() for i in range(1, len(tiles)+1): for perm in permutations(tiles,i): allPerms.add(perm) return len(allPerms) ``` Time Complexity: O$(n!)$ | Space Complexity: O$(n!)$