educative.io

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:

[[4,2,76],[1,3,79],[3,1,81],[4,3,30],[2,1,47],[1,5,61],[1,4,99],[3,4,68],[3,5,46],[4,1,6],[5,4,7],[5,3,44],[4,5,19],[2,3,13],[3,2,18],[1,2,0],[5,1,25],[2,5,58],[2,4,77],[5,2,74]]
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
Lesson: https://www.educative.io/courses/grokking-coding-interview-patterns-python/g7Xy5J7qgj3

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!