> For the complete documentation index, see [llms.txt](https://programming.arora-aditya.com/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://programming.arora-aditya.com/leetcode/backtracking/1079.-letter-tile-possibilities.md).

# 1079. Letter Tile Possibilities

### Approach 1: Generate All permutations

```python
class Solution:        
    def numTilePossibilities(self, tiles: str) -> int:
        ans = 0
        for i in range(1, len(tiles)+1):
            ans += len(set(itertools.permutations(tiles,i)))
        return ans
```

Use `itertools` to generate all the permutations of the given string, of all possible lengths and then add the number of unique strings in that list to get the answer

This solution although not the best comes in at 93.51% percentile at 48ms

> **Time Complexity:** *O(n!)*
>
> **Space Complexity:** *O(n!) \[since all strings are being stored, albeit temporarily]*
