mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-12 15:05:47 +08:00
fix: dynamic array in coin_change
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user