PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Maximize score in 15-sum card game

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic problem-solving in combinatorial search, state-space optimization, and memoization by asking for the maximum achievable score in a constrained card-removal game; it falls under the Coding & Algorithms domain, specifically combinatorics, search, and dynamic programming.

  • medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Maximize score in 15-sum card game

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem A deck has **36 cards**: 4 suits × ranks 1 through 9 (so there are exactly four `1`s, four `2`s, …, four `9`s). Suits do not affect scoring; only ranks matter. A game proceeds as follows: 1. The deck is shuffled into a fixed order. The first **16 cards** are dealt face-up onto the table (the “board”). The remaining cards stay in the draw pile. 2. While possible, you may repeatedly: - Choose **three cards currently on the board** whose ranks sum to **15**. - Remove those three cards and gain **15 points**. - Draw cards from the draw pile to restore the board back to **16 cards** (draw exactly 3 if available; otherwise draw as many as remain). 3. The game ends when either: - The draw pile is empty and no further 15-sum triple exists on the board, or - No 15-sum triple exists on the board (even if cards remain in the pile, you cannot draw unless you remove a triple). The theoretical maximum score is `180` (12 triples × 15 points) because there are 36 cards. ### Task Given the full shuffled deck order, compute the **maximum total score** achievable by choosing triples optimally. ### Input - A list `deck` of length 36. Each element is an integer rank in `[1..9]`. - The multiset of ranks in `deck` satisfies: each rank 1..9 appears exactly 4 times. ### Output - An integer: the maximum score achievable. ### Examples (illustrative) - If the initial 16-card board contains no triple summing to 15, output is `0`. - If an optimal play can remove 12 triples, output is `180`. ### Follow-ups (if time) 1. Implement a baseline greedy strategy (e.g., pick any available 15-sum triple). 2. Write a test that runs the game for 100 random shuffles and reports how often the strategy achieves 180. ### Constraints - Deck size is fixed (36), but the branching factor can be high; design an approach that avoids exponential blow-ups where possible (e.g., memoization).

Quick Answer: This question evaluates algorithmic problem-solving in combinatorial search, state-space optimization, and memoization by asking for the maximum achievable score in a constrained card-removal game; it falls under the Coding & Algorithms domain, specifically combinatorics, search, and dynamic programming.

Related Interview Questions

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)
Meta logo
Meta
Jan 18, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
8
0
Loading...

Problem

A deck has 36 cards: 4 suits × ranks 1 through 9 (so there are exactly four 1s, four 2s, …, four 9s). Suits do not affect scoring; only ranks matter.

A game proceeds as follows:

  1. The deck is shuffled into a fixed order. The first 16 cards are dealt face-up onto the table (the “board”). The remaining cards stay in the draw pile.
  2. While possible, you may repeatedly:
    • Choose three cards currently on the board whose ranks sum to 15 .
    • Remove those three cards and gain 15 points .
    • Draw cards from the draw pile to restore the board back to 16 cards (draw exactly 3 if available; otherwise draw as many as remain).
  3. The game ends when either:
    • The draw pile is empty and no further 15-sum triple exists on the board, or
    • No 15-sum triple exists on the board (even if cards remain in the pile, you cannot draw unless you remove a triple).

The theoretical maximum score is 180 (12 triples × 15 points) because there are 36 cards.

Task

Given the full shuffled deck order, compute the maximum total score achievable by choosing triples optimally.

Input

  • A list deck of length 36. Each element is an integer rank in [1..9] .
  • The multiset of ranks in deck satisfies: each rank 1..9 appears exactly 4 times.

Output

  • An integer: the maximum score achievable.

Examples (illustrative)

  • If the initial 16-card board contains no triple summing to 15, output is 0 .
  • If an optimal play can remove 12 triples, output is 180 .

Follow-ups (if time)

  1. Implement a baseline greedy strategy (e.g., pick any available 15-sum triple).
  2. Write a test that runs the game for 100 random shuffles and reports how often the strategy achieves 180.

Constraints

  • Deck size is fixed (36), but the branching factor can be high; design an approach that avoids exponential blow-ups where possible (e.g., memoization).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Software Engineer•Meta Software Engineer•Meta Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.