NeetCode #653LC-815HardAdvanced Graphs
← Back to All Problems

#653 · #815 · Bus Routes(公交路线)

📌 Problem Statement & Constraints

You are given routes where routes[i] is the list of stops of bus route i, plus source and target. You start at source and may ride any route; each new route counts as one bus. Return the minimum number of buses, or -1. Constraints: 1 <= routes.length <= 500, total stops <= 10^5, 0 <= source, target < 10^6.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!