There is a one-way circular route from City A to City X. In between these 2 cities,
there are a number of cities separated by any distance. Each city has a petrol pump
and holds a different storage capacity. The total petrol available in all the cities
put together is say 'Z' litres. The total distance between City A to City X will be
'Z' kilo meters. Assume the bike has a mile-age of 1 litre per KM.
Your goal is to around the circle, starting with no petrol. Find which city you will
start first, to ensure you wont run out of petrol mid-way.
Solution
No comments:
Post a Comment