retagged by
426 views
2 votes
2 votes
There are a number of tourist spots in a city and a company GoMad runs shuttle services between them. Each shuttle plies between a designated origin and destination, and has a name. Due to lack of coordination, the same name may be allotted to multiple routes.

To make matters worse, another company GoCrazy introduces its shuttle services using the same set of shuttle names. A GoMad shuttle and a GoCrazy shuttle with the same name may start at different origins and$/$or end at different destinations.

A pass from a company allows unlimited travel in all the company’s shuttles. For each company, we have a list that specifies all routes allotted to each shuttle name.

Design an algorithm to find out if there is a source $s$, a target $t$, and a sequence of shuttle names $σ$ such that, irrespective of whether you are carrying a GoMad pass or a GoCrazy pass, you can start at $s$ and arrive at $t$ using the sequence $σ$.
retagged by

1 Answer

Related questions