fix: dynamic array in coin_change

This commit is contained in:
realstealthninja
2024-10-01 23:11:46 +05:30
parent c7064a632f
commit 7984cd41c8

View File

@@ -1,11 +1,13 @@
#include <climits>
#include <iostream>
#include <vector>
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
int dp[N + 1];
std::vector<int> dp;
dp.reserve(N + 1);
// 0 coins are needed for 0 sum