You want to make a dessert and are given two integer arrays, baseCosts and toppingCosts, as well as an integer target.
To prepare the dessert, you must follow these rules:
You must choose exactly baseCosts.
You may choose toppingCosts.
Return the total cost of the dessert that is closest to target. If there is a tie, return the lower cost.
Constraints:
n baseCosts.length
m toppingCosts.length
n, m
baseCosts[i], toppingCosts[i]
target
You want to make a dessert and are given two integer arrays, baseCosts and toppingCosts, as well as an integer target.
To prepare the dessert, you must follow these rules:
You must choose exactly baseCosts.
You may choose toppingCosts.
Return the total cost of the dessert that is closest to target. If there is a tie, return the lower cost.
Constraints:
n baseCosts.length
m toppingCosts.length
n, m
baseCosts[i], toppingCosts[i]
target