Lets Travel
CodeChefOpen on judge ↗
There are N cities which are initially disconnected. Sri lives in city 1, while his N − 1 friends lives in the remaining cities (no two friends live in the same city). The distance between two city is given by the absolute difference of the number of the two cities. The distance between city 5 and city 10 is given by abs(10 − 5) = 5. Now, if Sri wants to visit one of his friends, then he prefers t
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