← All problemsSign in

CHEF AND HIS JOURNEY

Chef wants to travel today. There are **N** straight roads, all parallel to **x-axis** (in Cartesian coordinate system), with every road having its start point on **y-axis**. The first road has its start point on origin **(0, 0)** (look at the figure below). All other roads are above the first one, (in order) i.e. **(i+1)th** road is just above **ith** road. The **ith** road has a length **Li**

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