Skip to main content
LeetCode 1079, Medium. Topics: Hash Table, String, Backtracking, Counting. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 14 parametrized pytest cases, and a playground notebook:

Problem

You have <code>n</code>  <code>tiles</code>, where each tile has one letter <code>tiles[i]</code> printed on it. Return <em>the number of possible non-empty sequences of letters</em> you can make using the letters printed on those <code>tiles</code>.

Examples

Constraints

  • <code>1 <= tiles.length <= 7</code>
  • <code>tiles</code> consists of uppercase English letters.

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

NeetCode All.
Last modified on September 7, 2026