Optimal Trip
Chef has decided to take a break, and go for a ride. He is currently in city 0, and he wants to get to city N. The cities along the road from 0 to N are numbered 0, 1, 2, 3, ... N-1, N in increasing order of distance from city 0. The distance between cities i and i-1 is denoted by di. However, as is always the case, it is unsafe to travel at night, so he will have to break his journey over multip
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.
Sign in to chat with the tutor and save your progress.
Sign in to start