We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7064a6 commit 7984cd4Copy full SHA for 7984cd4
dynamic_programming/coin_change.cpp
@@ -1,11 +1,13 @@
1
#include <climits>
2
#include <iostream>
3
+#include <vector>
4
using namespace std;
5
6
// Function to find the Minimum number of coins required to get Sum S
7
int findMinCoins(int arr[], int n, int N) {
8
// dp[i] = no of coins required to get a total of i
- int dp[N + 1];
9
+ std::vector<int> dp;
10
+ dp.reserve(N + 1);
11
12
// 0 coins are needed for 0 sum
13
0 commit comments