Yahoo India Web Search

Search results

  1. leetcode.com › problems › coin-changeCoin Change - LeetCode

    Coin Change - 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.

  2. Coin Change II - You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the number of combinations that make up that amount.

  3. Mar 11, 2021 · Problem Statement Question: https://leetcode.com/problems/coin-change/ You are given coins of different denominations and a total amount of money amount. Write a function to compute 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.

  4. class Solution {public: int coinChange (vector < int >& coins, int amount) {// dp[i] := the minimum number of coins to make up i vector < int > dp (amount + 1, amount + 1); dp [0] = 0; for (const int coin: coins) for (int i = coin; i <= amount; ++ i) dp [i] = min (dp [i], dp [i-coin] + 1); return dp [amount] == amount + 1?-1: dp [amount];}};

  5. Coin Change is a Leetcode medium level problem. Let’s see the code, 322. Coin ChangeLeetcode Solution. Table of Contents. Problem. 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.

  6. Nov 20, 2022 · Coin Change (LeetCode 322) | Full solution with beautiful diagrams and visuals | Simplified. One cannot emphasize enough how important this problem is. Almost asked in every tech company at...

  7. Jun 27, 2024 · Learn dynamic programming, BFS, and memoization techniques to solve the Coin Change problem on LeetCode with step-by-step Python solutions.

  8. The Coin Change problem on LeetCode is a classic dynamic programming problem where we are given a set of coins and a target amount to reach with those coins. The problem statement is as follows: You are given coins of different denominations and a total amount of money amount.

  9. This video explains a very important and famous dynamic programming interview problem which is the coin change problem.It is a variation of Unbounded knapsac...

  10. leetcode.com › problems › coin-changeCoin Change - LeetCode

    Coin Change - 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.