I knew LC 1239 and started sketching backtracking before they mentioned the input size.
Model each word as a 26-bit mask of its distinct letters, then the problem reduces to selecting a subset of masks with pairwise disjoint bits that maximizes the total number of set bits. Use dynamic programming over bitmasks (or branch-and-bound with pruning) to find the optimal subset, and discuss trade-offs between exact and approximate solutions for 10,000 words.
Pro tip: Mention that you can preprocess by removing words that are subsets of others or have duplicate letters, and that the DP state can be compressed to only reachable masks, often making the solution feasible for 10,000 words. Also, note that if the alphabet were larger, you'd need a different approach, showing awareness of problem constraints.
Confirm the alphabet size (assume 26 lowercase letters), that each word can be used at most once, and that the goal is to maximize distinct letters covered with no letter repeated across chosen words.
For each word, compute a 26-bit integer where bit i is set if the i-th letter appears. Discard words with duplicate letters (mask popcount != word length) and remove words whose mask is a subset of another word's mask.
Let dp[mask] = maximum number of distinct letters achievable using a subset of words whose combined mask is exactly 'mask'. Initialize dp[0]=0. For each word mask w, update dp[mask | w] = max(dp[mask | w], dp[mask] + popcount(w)) if mask & w == 0.
The naive DP over all 2^26 masks is too large, but only reachable masks from disjoint unions of word masks are considered. Use a hash map or array for reachable states, and process words in any order. Complexity is O(N * R) where R is number of reachable masks, typically much smaller than 2^26.
If exact solution is too slow, consider greedy or beam search for approximate results. Mention that the problem is NP-hard in general (set packing), but with 26 letters and 10,000 words, the DP is practical. Also note that if words can be reused, it's a different problem.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.