← All problemsSign in

John Time Path

You are given a graph representing the path from John's home to various locations you need to find the shortest path in the graph from source to destination. Formally, the difference between adjacent edge weights in the shortest path should keep on switching from positive to negative and from negative to positive. And the first difference should be positive. ###Input Format First Line contain

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