FastPrepPartition a Card Deck into Fifteens
Problems/Partition a Card Deck into Fifteens

Partition a Card Deck into Fifteens

Meta logoMeta● HardFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The report describes a 36-card deck with values 1–9, choosing triples summing to 15, and a full-deck completion objective. The original stochastic reveal/replenishment benchmark is narrowed to the full visible-deck feasibility core explicitly mentioned by the source; match is about 79%.

Given the visible values of an entire card deck, decide whether every card can be consumed by partitioning the deck into disjoint groups of exactly three cards whose values sum to 15.

Cards are distinct physical cards even when values repeat. Every card must appear in exactly one group.

Function

canPartitionIntoFifteens(cards: int[]) → boolean

Examples

Example 1

cards = [1,5,9,2,6,7]return = true

The deck can be grouped as (1,5,9) and (2,6,7).

Example 2

cards = [1,1,1]return = false

The only triple sums to 3.

Example 3

cards = [5,5,5,5,5,5]return = true

Two identical triples each sum to 15.

Constraints

  • 0 <= cards.length <= 36 and its length is divisible by 3.
  • 1 <= cards[i] <= 9.

More Meta problems

  • Count Events in Rolling Minute WindowsPHONE SCREEN · Seen Oct 2026
  • Valid Word AbbreviationPHONE SCREEN · Seen Oct 2026
  • Shortest Path in a Binary MatrixPHONE SCREEN · Seen Sep 2026
All Meta interview questionsSee Meta hiring insights
Saved
public boolean canPartitionIntoFifteens(int[] cards) {
    // Write your solution here.
}
Checking account…