diff --git a/dynamic_programming/coin_change.cpp b/dynamic_programming/coin_change.cpp index bdde1e482..f4c0541fd 100644 --- a/dynamic_programming/coin_change.cpp +++ b/dynamic_programming/coin_change.cpp @@ -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 dp; - dp.reserve(N + 1); + std::vector dp(N + 1); // 0 coins are needed for 0 sum