Pinterest Interview Question

Reconstruct route from unordered travel tickets