LeetCode 1774. Closest Dessert Cost
DP
Input: baseCosts = [1,7], toppingCosts = [3,4], target = 10
Output: 10
Explanation: Consider the following combination (all 0-indexed):
- Choose base 1: cost 7
- Take 1 of topping 0: cost 1 x 3 = 3
- Take 0 of topping 1: cost 0 x 4 = 0
Total: 7 + 3 + 0 = 10.Solution:
PreviousLeetCode 1771. Maximize Palindrome Length From SubsequencesNextLeetCode. 1775 Equal Sum Arrays With Minimum Number of Operations
Last updated