Practice Total Distance Traveled
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
A truck has two fuel tanks. You are given two integers, mainTank representing the fuel present in the main tank in liters and additionalTank representing the fuel present in the additional tank in liters. The truck has a mileage of 10 km per liter. Whenever 5 liters of fuel get used up in the main tank, if the additional tank has at least 1 liters of fuel, 1 liters 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.
Source: Total Distance Traveled on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
mainTank = 5, additionalTank = 10
60
# Example 2
mainTank = 1, additionalTank = 2
10
Constraints
Related LeetCode Problems
Practice more problems similar to Total Distance Traveled.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.