Skip to content

Commit f283417

Browse files
committed
update 815 java
1 parent 65acaac commit f283417

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

leetcode_java/src/main/java/LeetCodeJava/BFS/BusRoutes.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ public int numBusesToDestination_1(int[][] routes, int source, int target) {
9999
}
100100
HashMap<Integer, ArrayList<Integer>> adjList = new HashMap<>();
101101
// Create a map from the bus stop to all the routes that include this stop.
102+
/**
103+
* NOTE !!!
104+
*
105+
* the `key` of map is the `route` index
106+
*/
102107
for (int r = 0; r < routes.length; r++) {
103108
for (int stop : routes[r]) {
104109
// Add all the routes that have this stop.
@@ -150,9 +155,7 @@ public int numBusesToDestination_1(int[][] routes, int source, int target) {
150155
// V2
151156
// IDEA : Breadth-First Search (BFS) with Routes as Nodes (test OK)
152157
// https://leetcode.com/problems/bus-routes/editorial/
153-
154158
List<List<Integer>> adjList = new ArrayList();
155-
156159
// Iterate over each pair of routes and add an edge between them if there's a
157160
// common stop.
158161
void createGraph(int[][] routes) {

0 commit comments

Comments
 (0)