Company: Publicius sapienet_5nov
Difficulty: medium
Maximize Money Earned from Spare Parts Problem Description An automobile mechanic needs to purchase spare parts from a manufacturing unit. Each part has a specific cost, and the mechanic earns money by replacing parts. For the i th spare part: The cost to purchase it is cost[i] . The mechanic earns 2^i when replacing it. The manufacturing unit offers n different spare parts. The mechanic has x amount of money available for purchases. Your task is to determine the maximum amount the mechanic can earn by strategically selecting which parts to buy. Since this amount could be large, return the answer modulo (10^9 + 7) . Complete the function findMaximumMoneyEarned in the editor with the following parameter(s): int cost[n] : each cost[i] denotes the cost of buying the i th item. int x : the amount of money the mechanic has. Returns: int : the maximum amount of money the mechanic can earn % (10^9 + 7) . Examples Example 1: Input: n = 5, cost = [10, 20, 14, 40, 50], x = 70 Output: 20 Explanat