
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Could you convert this into a graph problem?
Consider the pairs as edges and each number as a node.
We have to find an Eulerian path of this graph. Hierholzer’s algorithm can be used.