← All problemsSign in

FUEL CONSUMPTION

Chefu is planning to go on a space trip. He has a list of $N$ planets that he wishes to visit. The planets are arranged in a row. You are given the fuel consumed by the Chef's space ship to go to $i_{th}$ planet from $i-1_{th}$ planet. Chefu is very much concerned about the fuel in his spaceship as he doesn't want to get trapped in space. So he will ask you $Q$ queries to know the total amount of

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start