Meta interview question
Pick words with no shared characters to maximize character coverage
- Company:
- Meta
- Type:
- Coding
- Difficulty:
- Medium
- Reported:
- November 15, 2026
Problem
This came from an AI-assisted coding round.
You get a list of words and an alphabet. Pick a subset of the words so that their combined character coverage is as large as possible, where no two picked words may share even one character. Coverage is the number of distinct characters that appear in the picked words.
Return the maximum coverage and one subset of words that achieves it.
Example 1
Input: words = ["ab", "cd", "ace", "f"], alphabet = "abcdef"
Output: 5, ["ab", "cd", "f"]
"ace" conflicts with both "ab" and "cd", so the best choice covers a, b, c, d and f.
Example 2
Input: words = ["aa", "ab"], alphabet = "ab"
Output: 2, ["ab"]
Both words contain "a", so only one can be picked; "ab" covers more characters.
Constraints
- Not stated; ask the interviewer.
Reported by candidates or drawn from publicly available sources, and rewritten in our own words. Pathwise Prep does not publish confidential assessment content. Report a concern