LeetCode 784 Letter Case Permutation - Solution

The pattern

Use backtracking. Process each character left to right.

If the character is a digit, add it and recurse.

If the character is a letter, branch: one path with lowercase, one path with uppercase.

When you reach the end of the string, add the result.

This is similar to subsets: for each letter, make a binary choice (lower or upper).