Search⌘ K
AI Features

Solution: Bus Routes

Solution: Bus Routes gives an array of bus routes that repeat forever. Return the minimum buses needed to reach a destination station from a source, or -1 if unreachable.

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 ...