[Community Puzzle] Plague, Jr


#41

Edit : now i’m stuck like some posters above, I.e : the Advanced case, i find a diameter of 10 instead of 26.

Could we at least have the “start pad”, so we can see what’s wrong with our diameter research (i don’t have enough patience for testing 999 pad myself unfortunately).

thx you


#42

I tried to find a way to answer your question w/o giving too much hints, but it’s hard. Maybe it’s that: Imagine that you have 2 tapes with different, but known lengths. Stick them together. You have 1 tape and you know the length of it. Do you need to know where the middle position is to calculate the half of the length of the new tape? No. One more hint: this is a typical divide and conquer task.


#43

Thx for answering, i understood your tip with my above neighbour JBM.
The thing here is a problem with the third test (advanced case) where like some other ppl i found a diameter of 10 instead of 26.
Do you have the “optimal” start node so i can manage finding why my code didn’t find the right diameter ?


#44

There is no optimal, or dedicated node. You can solve all puzzles from any node. Try to understand the divide and conquer algorithm in which you split the main task to several and identical small ones.


#45

I must have some difficulties with english because it’s not what I mean.

More precisely, my question is : what pair of node can generate a diameter of 26 ?
With that, I can track my algorithm when it go through them. So I can debug when I compute the diameter because you can understand i can’t debug 499500 possibilities ((999+1)*999/2) manually.
Usually, the last unit test are more harder to pass than the first one. Here it’s not the case…
I would never thought I would have one day so much difficulties with a simple bfs :frowning:


#46

Edit : for those who have reached the 13 result of diameter for the advanced case, here a tip which saved me : don’t forget to NOT return something if you find a “dead end”.
the different unit test pass because the first neighbour never end into a “dead end” (at least, not the pair of node which let us compute the maximum diameter).


#47

When you find the longest path, you find the shortest time…