What is the best algorithm to solve the car refuelling puzzle below? There is a queue of N cars waiting at the filling station. 3 fuel dispensers, x, y, z. When a car arrives at front of the queu, driver can choose to go to any dispenser not occupied. If all unoccupied dispensers have less than required by the driver he has to wait. if more than one dispenser has the required liter, the driver chooses the one labeled with the smallest letter.
Calculate max amount of waiting time. Assume taking one liter of fuel takes exactly one second? example A[2,8,4,3,2], x= 7, y=11, z=3, then cars will be waiting 0, 0, 2, 2, 8 seconds.