← All problemsSign in

Travellling

Given is a travel description. You start at time t = 0. You start at source s and Reach Destination d. And n-2 intermediate points. It is guaranteed that once you step out from a node, you don't come back to it ever again. i.e., 1 -> 2 -> 3 is shown by input 1 2 2 3 and 1 -> 2 -> 1 is an invalid movement. This holds until you reach your destination. Once you reach destination, you make

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