← All problemsSign in

Pappu and DFS

CodeChefRating 2509Open on judge ↗

Pappu today learnt that there can be many orderings of DFS possible in the same graph. Now he wants to know whether it is possible to obtains a particular permutation by performing DFS on the given graph. He usually asks his mom for help but since she is out of town, he wants you to help him. You are given a graph with $n$ nodes numbered from 1 to $n$ and $m$ edges. You are also given a permutati

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