Compute total revenue from greedy VM rentals | Amazon Interview Question