fix: vla in coin_change

This commit is contained in:
realstealthninja
2024-10-04 19:49:50 +05:30
parent 3091f1502c
commit 94ca2dffba

View File

@@ -6,8 +6,7 @@ using namespace std;
// Function to find the Minimum number of coins required to get Sum S
int findMinCoins(int arr[], int n, int N) {
// dp[i] = no of coins required to get a total of i
std::vector<int> dp;
dp.reserve(N + 1);
std::vector<int> dp(N + 1);
// 0 coins are needed for 0 sum