We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c6eb68 commit e745eceCopy full SHA for e745ece
docs/Leetcode_Solutions/Python/815._Bus_Routes.md
@@ -56,12 +56,14 @@ class Solution(object):
56
for bus in cur_buses:
57
if bus == T:
58
return step
59
+
60
for route_idx in bus_in_routes[bus]:
61
if route_idx not in visited:
62
visited.add(route_idx)
63
for new_bus in routes[route_idx]:
64
if new_bus != bus:
65
new_buses.append(new_bus)
66
+ routes[route_idx] = [] # this line is optional, more efficient if added
67
cur_buses = new_buses
68
step += 1
69
return -1
0 commit comments