A truck has two fuel tanks. You are given two integers,
mainTankrepresenting the fuel present in the main tank in liters andadditionalTankrepresenting the fuel present in the additional tank in liters.The truck has a mileage of
10km per liter. Whenever5liters of fuel get used up in the main tank, if the additional tank has at least1liters of fuel,1liters of fuel will be transferred from the additional tank to the main tank.Return the maximum distance which can be traveled.
Note: Injection from the additional tank is not continuous. It happens suddenly and immediately for every 5 liters consumed.
1 | class Solution { |