Leetcode 815. Bus Routes
Given repeating bus routes and start/target stops, find the minimum number of bus rides required to go from source to target (or -1 if impossible). This is solved by modeling routes/stops as a graph (e.g., routes as nodes connected when they share stops) and performing BFS to find the shortest transfer path — note constraints: up to 500 routes and 1e5 total stop entries.
Asked at:
PayPal
Uber
Amazon
Coupang
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early February, 2026
PayPal
Senior
You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever. For example, if routes[0] = [1, 5, 7], this means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ... forever. You will start at the bus stop source (You are not on any bus initially), and you want to go to the bus stop target. You can travel between bus stops by buses only. Return the least number of buses you must take to travel from source to target. Return -1 if it is not possible.
Mid October, 2025
Coupang
Staff
https://leetcode.com/problems/bus-routes/
Early July, 2025
Uber
Senior
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.