Algorithm · IBM · Medium
A cloud provider offers n virtual machine (VM) types. You are given an array vmStock where vmStock[i] is the number of available instances of VM type i. Customers arrive one by one. Every customer rents exactly one VM. For each rental, the provider must pick a VM type whose remaining inventory is currently the largest. If several VM types are tied, any of them may be chosen. The customer is billed an amount equal to the selected inventory count before the rental. After…
Checking your access…