https://github.com/derec4/coin-change-problem
Solution and explanation for a common interview question. Involves dynamic programming.
https://github.com/derec4/coin-change-problem
dynamic-programming interview interview-questions leetcode leetcode-solutions
Last synced: 6 months ago
JSON representation
Solution and explanation for a common interview question. Involves dynamic programming.
- Host: GitHub
- URL: https://github.com/derec4/coin-change-problem
- Owner: DereC4
- Created: 2024-07-21T06:56:13.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-21T07:05:25.000Z (about 1 year ago)
- Last Synced: 2024-07-21T08:23:48.680Z (about 1 year ago)
- Topics: dynamic-programming, interview, interview-questions, leetcode, leetcode-solutions
- Language: Java
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[322\. Coin Change](https://leetcode.com/problems/coin-change/)
Medium
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`.
You may assume that you have an infinite number of each kind of coin.
Example 1:
Input: coins = [1,2,5], amount = 11
Output: 3
Explanation: 11 = 5 + 5 + 1Example 2:
Input: coins = [2], amount = 3
Output: -1Example 3:
Input: coins = [1], amount = 0
Output: 0Constraints:
- `1 <= coins.length <= 12`
- `1 <= coins[i] <= 231 - 1`
- `0 <= amount <= 104`