← Back
00:00

Denomination Breakdown

Datadog interview questions · Medium · Coding round · 6 tests

You are given a list of distinct positive denominations and a target amount. Find a way to sum exactly to the target using the fewest total denominations.

Return the answer as a counts array aligned with the input order: the value at index i is how many times denominations[i] is used.

Interface

findDenominationBreakdown(
  denominations: number[],
  target: number,
): number[]

Rules

Idle