← All problemsSign in

String and Graphs

You are provided with a **weighted undirected** graph $G$ and string $S$. Each node in $G$ has a letter attached to it. Find the **minimum** cost of a walk in $G$ such that the path contains $S$ as a **subsequence** i.e. $S$ can be formed by removing $0$ or more characters from the string formed by the concatenation of letters on the nodes on the walk. You are allowed to begin as well as end your

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