← All problemsSign in

Rental car

John and Bella rent a car, to tour the city of Paris. Let there be X petrol pumps in a circle, numbered from 0 to (X-1) (both inclusive). Two things are known about each petrol pump: a) the amount of petrol that particular petrol pump will give, and b) the distance from that petrol pump to the next petrol pump. Assuming John could start the tour at any of the petrol pumps, and given a tank of in

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