Skip to content

Commit 94ca2df

Browse files
fix: vla in coin_change
1 parent 3091f15 commit 94ca2df

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

dynamic_programming/coin_change.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ using namespace std;
66
// Function to find the Minimum number of coins required to get Sum S
77
int findMinCoins(int arr[], int n, int N) {
88
// dp[i] = no of coins required to get a total of i
9-
std::vector<int> dp;
10-
dp.reserve(N + 1);
9+
std::vector<int> dp(N + 1);
1110

1211
// 0 coins are needed for 0 sum
1312

0 commit comments

Comments
 (0)