There arent enough test cases

my code passed all your test cases (11 of them) but failed one on leetcode. it failed the following test:

n = 5
k = 3

This is because I was only adding to the BFS que if it was not found in the hashset storing min distances. i needed to also add to que if it was already visited but we were able to update the minimum distance to that node. this is an important distinction!

Course: Grokking Coding Interview Patterns in Python - Learn Interactively

1 Like

Hello @Dylan_Breon,

Thank you for pointing out this issue. The test case you suggested is an important edge case for this problem. We’ll let you know once the lesson has been updated and is live again.

Feel free to suggest any more improvements. We’ll be happy to help.

Hi @Dylan_Breon, the test cases have been updated, and the updated version of this lesson is live. Thanks!