Problem Brief
Find Minimum Price to Spend
OA
Given an array price[1-n] and m (discount), find the minimum price to spend to buy all the items.
Use the following formula to apply the coupon: price[i] / 2^x, where x is the number of coupons used, and i is the index of the item in the array.
Function Description
Complete the function findMinimumPriceToSpend in the editor.
findMinimumPriceToSpend has the following parameters:
- 1.
int[] price: an array of integers representing the price of each item - 2.
int m: the number of discounts available
Returns
int: the minimum price to spend
1Example 1
Input
price = [1, 2, 3], m = 2
Output
3
Explanation
🦦
Constraints
Limits and guarantees your solution can rely on.
🦦