Back to problems

Minimum Transfers Between Pin Boards

Algorithm · Pinterest · Hard

A city transit network is represented by a list routes. Each entry routes[i] is an array of stop IDs served by one bus route. If you board a route, you may ride to any stop that appears in that route. You can transfer between two routes at any stop that belongs to both routes. You start at stop source and need to reach stop target. Return the minimum number of bus routes you must board to travel from source to target. If no sequence of buses can take you from source to…

Checking your access…