To solve this problem, you'll have to open it on the computer

Letter Tile Possibilities

Back Tracking
medium
Score: 30

You are given a String 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.

Input Format:

First parameter: String tiles

Output Format:

Return the number.

Example 1:

Input:
AAB
Output:
8
Explanation: The possible sequences are "A", "B", "AA", "AB", "BA", "AAB", "ABA", "BAA".

Example 2:

Input:
AAABBC
Output: 
188

Constraints:

  • 1 <= tiles.length <= 7
  • tiles consists of uppercase English letters.
  • Expected Time Complexity: O(n!)
  • Expected Space Complexity: O(n!)
Submit code to see the your result here