Tell us what’s happening:
The math in this problem is incorrect:
The key is that 1 kg of fuel lifts 5 kg total mass. In that 5 kg, 1 kg is fuel and the remaining 4 kg is payload, so the ratio of fuel to payload is 1/4. There is no need for iteration — the exact fuel can be calculated directly. This approach is not only simpler but also faster, with O(1) time complexity compared to the O(log n) complexity of the iterative method used in the example.
Your code so far
function launchFuel(payload) {
return +(payload/4).toFixed(1);
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:143.0) Gecko/20100101 Firefox/143.0
Challenge Information:
Daily Coding Challenge - Space Week Day 7: Launch Fuel
https://www.freecodecamp.org/learn/daily-coding-challenge/2025-10-10