Special Shortest Walk
You are given an undirected graph, you need to find the shortest walk in the graph from source to sink which satisfies the following property: Let the shortest walk from source to sink be through edges E1 -> E2 -> ... -> Ek, then Weight(E1) > Weight(E2) 3) > Weight(E4) .....and so on. Formally, the difference between adjacent edge weights in shortest walk should keep on switching from positive 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