Compute total revenue from greedy VM rentals | Amazon Coding Question