Company: Amazon_24dec
Difficulty: medium
Maximize Revenue from Flash Sale Maximize Revenue from Flash Sale Problem Description Amazon is hosting a flash sale for a high-demand product, sourced from multiple suppliers. Each supplier has a limited stock, represented by the array supplierStock , where each element indicates the number of units available from a particular supplier. To maximize revenue, Amazon follows a dynamic pricing strategy with the following rules: At any given time, only one unit can be sold from a supplier. The revenue from selling a unit is equal to the supplier's current stock level at that moment. After a sale, the supplier's stock decreases by one, and the revenue for selling another unit from that supplier is adjusted accordingly. If a supplier's stock reaches zero, no further sales can be made from them. Amazon aims to sell units in a way that maximizes total revenue by optimally selecting the available suppliers. Given an array supplierStock of length n , representing stock levels across suppliers, a