Skip to content

Commit 1aa6d9c

Browse files
committed
Fixing style errors
1 parent 404de05 commit 1aa6d9c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

exercises/practice/change/.approaches/dynamic-programming/content.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This approach ensures that we find the most efficient way to make change and han
77
## Explanation
88

99
1. **Initialize Coins Usage Tracker**:
10-
- We create a list `coinsUsed`, where each index `i` stores the most efficient combination of coins that sum up to the value `i`.
10+
- We create a list `coinsUsed`, where each index `i` stores the most efficient combination of coins that sum up to the value `i`.
1111
- The list is initialized with an empty list at index `0`, as no coins are needed to achieve a total of zero.
1212

1313
2. **Iterative Dynamic Programming**:
@@ -66,6 +66,7 @@ class ChangeCalculator {
6666
- **Space Complexity**: The space complexity is **O(n)** due to the list `coinsUsed`, which stores the most efficient coin combination for each total up to `grandTotal`.
6767

6868
- **Edge Cases**:
69+
6970
- If the `grandTotal` is negative, an exception is thrown immediately.
7071
- If there is no way to make the exact total with the given denominations, an exception is thrown with a descriptive message.
7172

@@ -74,6 +75,7 @@ class ChangeCalculator {
7475
- **Efficiency**: This approach is highly efficient in terms of minimizing the number of coins, but it might require significant memory for larger `grandTotal` values, as the space complexity grows linearly with `grandTotal`.
7576

7677
- **Alternative Approaches**:
78+
7779
- A **Greedy Approach** could be faster for some cases but does not always guarantee the minimum number of coins.
7880
- This dynamic programming approach is best when the goal is to guarantee the fewest coins possible, especially when no simple greedy solution exists.
7981

exercises/practice/change/.approaches/intrduction.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
## Introduction to Change Calculation
1+
# Introduction to Change Calculator
22

33
In the "Change Calculator" exercise, the goal is to determine the minimum number of coins needed to reach a given total using a specific set of coin denominations. This is a classic problem in dynamic programming, where efficient change-making is essential, especially when there are constraints on coin types or large totals.
44

55
### Problem Overview
66

77
Given:
8+
89
- A list of coin denominations, each representing an available currency unit.
910
- A total amount (`grandTotal`) we want to reach using the fewest possible coins from the given denominations.
1011

0 commit comments

Comments
 (0)