Solution: Trace the Complete Path of a Journey

Let’s solve the Trace the Complete Path of a Journey problem.

We'll cover the following

Statement

Given a list paths, where pathsipaths_i contains a pair of strings [sourcei,destinationi][source_i, destination_i] representing there exists a direct path from sourceisource_i to destinationidestination_i. Return the correct sequence of the whole journey from the first city to the last.

Note: It is guaranteed that a journey always exists.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.