Search⌘ K
AI Features

Solution: Bus Routes

Solution: Bus Routes asks you to find the minimum number of buses needed to travel from a source station to a destination, or return -1 if no route connects them.

Statement

You are given an array, routes, representing bus routes where routes[i] is a bus route that the ithi^{th} bus repeats forever. Every route contains one or more ...