← All problemsSign in

Shil and Shortest path

Shil has a undirected graph consisting of N nodes and M edges. Each edge of this graph has a label ('a'-'z') and weight 1. Shil is interested in all shortest paths from 1 to N. Any shortest path can be represented as a string formed by concatenating label of all the edges in order they are appearing in shortest path . Out of all shortest path strings , Shil wants lexicographical Kth strings. Lexi

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