#1774

Closest Dessert Cost

specialist · 905 · lc medium +31 · verified · 48.4% accepted · 734 likes · top 34%

Description

Make a dessert with exactly one ice cream base and optionally up to two portions of each topping. baseCosts holds base prices, toppingCosts holds per-portion prices, and target is your budget. Return the cost closest to target; on a tie return the lower cost.

Code

1
2
3