From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/coin_change2.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 other/coin_change2.cpp (limited to 'other/coin_change2.cpp') diff --git a/other/coin_change2.cpp b/other/coin_change2.cpp deleted file mode 100644 index 4680c95..0000000 --- a/other/coin_change2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// 518. Coin Change II -#include "leetcode.h" - -/* - * given an integer array 'coins' representing cons of different denominations - * and an integer 'amount' representing a total amount of money. return the - * number of combinations that make up the amount. if that amount of money - * cannot be made up by any combination the coins, return 0. you may assume that - * you have an infinite number of each kind of coin. the answer is guaranteed to - * fit into a signed 32-bit integer. - */ - -class Solution { -public: - int change(int amount, vector &coins) { - vector dp(amount + 1, 0); - dp[0] = 1; - for (int i : coins) - for (int j = i; j <= amount; j++) - dp[j] += dp[j - i]; - return dp[amount]; - } -}; - -int main() { - Solution obj; - vector c1 = {1, 2, 5}, c2 = {2}, c3 = {10}; - printf("%d\n", obj.change(5, c1)); // expect: 4 - printf("%d\n", obj.change(3, c2)); // expect: 0 - printf("%d\n", obj.change(10, c3)); // expect: 1 -} -- cgit v1.2.3