Road Trip Fuel Strategy
Picture this: you're on a road trip with your trusty truck, equipped with not one, but two fuel tanks: the main tank and an additional tank.You are given two string. The main tank has a certain amount of fuel, let's call it mainTank (in liters), and there's some extra fuel in the additional tank, called additionalTank (in liters).
Now, here's the deal: your truck gets a mileage of 10 kilometers per liter. But here's the twist - whenever your truck burns through 5 liters of fuel from the main tank, if there's at least 1 liter of fuel chilling in the additional tank, we'll transfer 1 liter from there to the main tank.
Your job? Figure out how far you can push the truck before needing to refuel.
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?