Company: ubs
Difficulty: medium
Maximize VM Rental Revenue Problem Description In a cloud computing platform, there are n types of virtual machines (VMs). Each VM type has a certain number of instances available for rent, represented by the array vmStock . Each time a VM of a certain type is rented, the customer pays a fee equal to the number of instances currently available for that type. There are m different customers arriving one by one, and each customer always chooses the most expensive VM available at that moment, i.e., the VM type with the most instances left. Implement a function to calculate the total revenue the platform can earn after serving all rental requests. The function maximizeRentalRevenue takes the following inputs: int vmStock[n] : the number of VMs of each type available initially int m : the number of customers requesting to rent a VM The function should return a long integer denoting the total revenue that can be earned after serving all customers' requests. Examples Example 1: Input: n = 3,