You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I really appreciate your passionable cource.
By the way, I may found a bug in BFS Graph Matrix.
As for the BFSGraphMatrix function bfs, if arguments of source and needle are same number, it returns null. But I think it should return the exact number in array.
I mean for example,
// src/day1/DFSGraphList.tsbfs(matrix,1,1))// expected output [1], but got null;
To solve this bug, I think the code should be modified like below.
- if (prev[needle] === -1) {- return null;- }+ if (prev[needle] === -1 && source !== needle) {+ return null;+}
Hi @ThePrimeagen and folks,
I really appreciate your passionable cource.
By the way, I may found a bug in BFS Graph Matrix.
As for the BFSGraphMatrix function bfs, if arguments of
source
andneedle
are same number, it returns null. But I think it should return the exact number in array.I mean for example,
To solve this bug, I think the code should be modified like below.
Also the test like below should be added .
The text was updated successfully, but these errors were encountered: