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/largest_int_add_target.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 other/largest_int_add_target.cpp (limited to 'other/largest_int_add_target.cpp') diff --git a/other/largest_int_add_target.cpp b/other/largest_int_add_target.cpp deleted file mode 100644 index 91015d0..0000000 --- a/other/largest_int_add_target.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - string largestNumber(vector &cost, int target) { - vector dp(target + 1, -10000); - dp[0] = 0; - for (int i = 1; i <= target; ++i) - for (int j = 0; j < 9; ++j) - dp[i] = max(dp[i], i >= cost[j] ? 1 + dp[i - cost[j]] : -10000); - if (dp[target] < 0) - return "0"; - string ans = ""; - for (int i = 8; i >= 0; --i) { - while (target >= cost[i] && dp[target] == dp[target - cost[i]] + 1) { - ans.push_back('1' + i); - target -= cost[i]; - } - } - return ans; - } -}; - -int main() { - Solution obj; - vector cost = {4, 3, 2, 5, 6, 7, 2, 5, 5}; - int target = 9; - cout << obj.largestNumber(cost, target); -} -- cgit v1.2.3