FastPrepCoin Change
Problems/Coin Change

Coin Change

The Walt Disney Company logoThe Walt Disney Company● EasyFULLTIMEOAONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The report lists LC322 and gives the minimum-count dynamic-programming recurrence.

The report does not give bounds or edge cases. Here, denominations are positive and reusable, the amount is at most 1000, zero needs no coins, and an unreachable amount returns minus one.

The judged task matches the report at about 90%.

Given positive coin denominations and a target amount, return the fewest coins needed to make that amount. You may use each denomination any number of times.

Return -1 if the amount cannot be made. Amount zero needs no coins. Denominations may be unordered or repeated; repeated denominations do not provide extra restrictions.

Function

coinChange(coins: int[], amount: int) → int

Examples

Example 1

coins = [1,3,4]amount = 6return = 2

Use 3 + 3, which needs two coins. No single denomination equals six, so fewer than two coins is impossible. A greedy choice of four would need three coins.

Example 2

coins = [4,6]amount = 5return = -1

Every available coin is even, so every sum is even. Five cannot be made; return -1.

Constraints

  • 1 <= coins.length <= 12
  • 1 <= coins[i] <= 100
  • 0 <= amount <= 1000

More The Walt Disney Company problems

  • Find All Paths for a Name in a File SystemPHONE SCREEN · Seen Nov 2026
  • Resizable Array-Backed Integer SetPHONE SCREEN · Seen Sep 2026
  • Shortest Path with Directional Move CostsPHONE SCREEN · Seen Sep 2026
All The Walt Disney Company interview questionsSee The Walt Disney Company hiring insights
Saved
class Solution {
    public int coinChange(int[] coins, int amount) {
        // Write your code here
    }
}
Checking account…