Design and Evaluate a Solver for a 36-Card Sum-Fifteen Game
Company: Meta
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: hard
Interview Round: Onsite
Design a solver and evaluation plan for a card-removal game. The deck contains 36 cards whose values are between 1 and 9. Each move selects three available table cards summing to 15. After a move, up to three cards are added from the remaining deck when available. Winning means consuming all 36 cards in 12 valid groups.
### Part 1 — Clarify the Game State
Explain the state representation and resolve the ambiguous visibility and dealing rules. The reported table size is uncertain between 15 and 16 cards; treat it as a configurable rule. The deck is described as visible, but that must be reconciled with only table cards being selectable and later cards being drawn randomly.
#### What This Part Should Cover
Separate knowledge of deck contents or draw order from legal availability. Preserve card multiplicities and distinguish deck exhaustion from clearing every card.
### Part 2 — Choose a Solving Strategy
Explain legal-move generation and compare a fast heuristic with search that considers future states. State what information the solver may use and whether its result is a guarantee or an empirical success rate.
#### What This Part Should Cover
Valid triples, duplicate values, state transitions, dead ends, search cost, and the effect of known versus hidden future draws.
### Part 3 — Evaluate on Many Games
Describe how you would assess correctness, win rate, and runtime on more than 1000 games without confusing sample noise or a changed workload with an algorithmic improvement.
#### What This Part Should Cover
Fixed game generation and seeds, identical comparisons, valid-move checks, reporting of failures, and an explicit resource budget.
### Constraints
Do not assume four copies of each value merely because 36 cards use values 1 through 9. The actual multiplicities, draw distribution, initial table size, and full-deck visibility semantics must be specified. This stochastic strategy task has no single deterministic console output under the unresolved rules.
### Clarifying Questions
- Does full visibility include future draw order, only remaining values, or something else?
- Is each refill a uniform sample without replacement, and what happens when fewer than three cards remain?
- Can the game ever add cards when no legal move exists?
- Is a deck guaranteed to be solvable, or are losing instances part of evaluation?
```hint Track a necessary total-value invariant
Twelve groups summing to 15 consume a total card value of 180. That condition alone does not prove that a legal sequence of table moves exists.
```
### What a Strong Answer Covers
- An honest treatment of the uncertain rules and legal information available to the solver.
- A coherent search or heuristic strategy with correct multiset transitions.
- Reproducible multi-game evaluation that separates correctness, success probability, and resource cost.
### Follow-up Questions
- How would a value-count state reduce duplicate move exploration?
- How would you compare two heuristics when many tested decks are unwinnable under either strategy?
Overview: Clarify a 36-card triple-sum game, compare legal search and heuristic strategies, and evaluate reproducible win rates and runtime across many games.
Design a solver and evaluation plan for a card-removal game. The deck contains 36 cards whose values are between 1 and 9. Each move selects three available table cards summing to 15. After a move, up to three cards are added from the remaining deck when available. Winning means consuming all 36 cards in 12 valid groups.
Part 1 — Clarify the Game State
Explain the state representation and resolve the ambiguous visibility and dealing rules. The reported table size is uncertain between 15 and 16 cards; treat it as a configurable rule. The deck is described as visible, but that must be reconciled with only table cards being selectable and later cards being drawn randomly.
What This Part Should Cover Guidance
Separate knowledge of deck contents or draw order from legal availability. Preserve card multiplicities and distinguish deck exhaustion from clearing every card.
Part 2 — Choose a Solving Strategy
Explain legal-move generation and compare a fast heuristic with search that considers future states. State what information the solver may use and whether its result is a guarantee or an empirical success rate.
What This Part Should Cover Guidance
Valid triples, duplicate values, state transitions, dead ends, search cost, and the effect of known versus hidden future draws.
Part 3 — Evaluate on Many Games
Describe how you would assess correctness, win rate, and runtime on more than 1000 games without confusing sample noise or a changed workload with an algorithmic improvement.
What This Part Should Cover Guidance
Fixed game generation and seeds, identical comparisons, valid-move checks, reporting of failures, and an explicit resource budget.
Constraints
Do not assume four copies of each value merely because 36 cards use values 1 through 9. The actual multiplicities, draw distribution, initial table size, and full-deck visibility semantics must be specified. This stochastic strategy task has no single deterministic console output under the unresolved rules.
Clarifying Questions Guidance
Does full visibility include future draw order, only remaining values, or something else?
Is each refill a uniform sample without replacement, and what happens when fewer than three cards remain?
Can the game ever add cards when no legal move exists?
Is a deck guaranteed to be solvable, or are losing instances part of evaluation?
What a Strong Answer Covers Guidance
An honest treatment of the uncertain rules and legal information available to the solver.
A coherent search or heuristic strategy with correct multiset transitions.
Reproducible multi-game evaluation that separates correctness, success probability, and resource cost.
Follow-up Questions Guidance
How would a value-count state reduce duplicate move exploration?
How would you compare two heuristics when many tested decks are unwinnable under either strategy?