arrow_back Back to Challenges

#322 Coin Change

Medium Acceptance 0%
description

Problem Description

You are given an integer array `coins` representing coins of different denominations and an integer `amount` representing a total amount of money. Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return `-1`.

checklist Constraints

1 <= coins.length <= 12
1 <= coins[i] <= 2^31 - 1
0 <= amount <= 10^4

science Examples

Case #1

In: coins = [1,5,10] amount = 12
Out: 3

Case #2

In: coins = [2] amount = 3
Out: -1

Mastery Tags

Arrays Dynamic Programming

Hiring Companies

Amazon Bloomberg Google
code

Integrated IDE

code_blocks
Coding
psychology
Aptitude