Skip to content

Commit

Permalink
Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
eminencegrs committed Dec 13, 2024
1 parent f58ff3c commit bce4c7a
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 26 deletions.
18 changes: 0 additions & 18 deletions LeetCode/src/LeetCode.Challenges/CoinChangeII/Description.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace LeetCode.Challenges.CoinChangeII;
namespace LeetCode.Challenges.Problems05xx.N_0518_CoinChangeII;

public static class BacktrackingSolution
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Coin Change II (#518)

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.
If that amount of money cannot be made up by any combination of the coins, return 0.

You may assume that you have an infinite number of each kind of coin.

The answer is guaranteed to fit into a signed 32-bit integer.

## Examples

### Example 0:

Input: `coins = [1, 2]`, `amount = 5`
Output: `3`
Explanation:
`5 = 1 + 1 + 1 + 1 + 1`
`5 = 1 + 1 + 1 + 2`
`5 = 1 + 2 + 2`

### Example 1:

Input: `coins = [1, 2, 5]`, `amount = 5`
Output: `4`
Explanation:
`5 = 1 + 1 + 1 + 1 + 1`
`5 = 1 + 1 + 1 + 2`
`5 = 1 + 2 + 2`
`5 = 5`

### Example 2:

Input: `amount = 3`, `coins = [2]`
Output: `0`
Explanation: the amount of 3 cannot be made up just with coins of 2.

### Example 3:

Input: `amount = 10`, `coins = [10]`
Output: `1`
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace LeetCode.Challenges.CoinChangeII;
namespace LeetCode.Challenges.Problems05xx.N_0518_CoinChangeII;

public static class RecursionWithMemo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using LeetCode.Challenges.CoinChangeII;
using Xunit;
using LeetCode.Challenges.Problems05xx.N_0518_CoinChangeII;
using Shouldly;
using Xunit;

namespace LeetCode.Challenges.UnitTests.CoinChangeII;
namespace LeetCode.Challenges.UnitTests.Problems05xx.N_0518_CoinChangeII;

public class BacktrackingSolutionTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using LeetCode.Challenges.CoinChangeII;
using LeetCode.Challenges.Problems05xx.N_0518_CoinChangeII;
using Shouldly;
using Xunit;

namespace LeetCode.Challenges.UnitTests.CoinChangeII;
namespace LeetCode.Challenges.UnitTests.Problems05xx.N_0518_CoinChangeII;

public class RecursionWithMemoTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;

namespace LeetCode.Challenges.UnitTests.CoinChangeII;
namespace LeetCode.Challenges.UnitTests.Problems05xx.N_0518_CoinChangeII;

public class TestData : IEnumerable<object[]>
{
Expand Down

0 comments on commit bce4c7a

Please sign in to comment.