Skip to content

LeetCode 322: Coin Change #67

@github-actions

Description

@github-actions

LeetCode 322: Coin Change

Category: Dynamic Programming
Difficulty: See LeetCode
Solution File: src/dynamic_programming/coin_change.py
Test File: tests/test_coin_change.py

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.
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 + 1

Example 2:
Input: coins = [2], amount = 3
Output: -1

Constraints:

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

Tasks

  • Implement the solution in src/dynamic_programming/coin_change.py
  • Ensure all test cases pass
  • Analyze time complexity
  • Analyze space complexity

Metadata

Metadata

Assignees

No one assigned

    Labels

    blind-75Blind 75 - Blind-75 problemsdynamic programmingBlind 75 - Dynamic Programming problems

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions