Represent small sets with masks
Model presence, union, intersection, and coverage without confusing frequency with membership.
Understand the idea
Assign one bit to each feature. OR forms a union, AND forms an intersection, and a subset test can use (A & B) == A. For lowercase letters, bit c − a records whether the letter occurs; a second occurrence does not create another bit.
Trace a small example
For features {0, 1, 2}, masks 101 and 110 have union 111 and intersection 100. The words aba and ab have the same presence mask. In a team-coverage problem, a mask choosing people and a mask describing skills are two different universes.
Conditions and cost
Choose a width large enough for the universe and reject invalid feature indices. Presence masks cannot answer frequency questions. For a fixed machine-word universe, set operations use constant time; evaluating many selected items still takes work.
Which fact is lost when a word is stored only as a letter-presence mask?
Turn the idea into code
Masks 0011 and 1100 describe two people’s skills. Do they cover required mask 1111 together?
Give me a hint
Combine skill masks with OR, not addition.
Show the explained solution
Yes: 0011 OR 1100 = 1111. In general test (covered & required) == required.
Your notes
Mark complete when you can explain it yourself.