Dwarfs standing on the shoulders of giants puzzle discussion

I think your second data set is wrong because cycles like (5,2) are not allowed according to the problem description.

Thanks this helped me fix the issue. In my case I did a mistake my topological sort implementation.

Thank you, you helped me with this user case.
For me it was the search of “root” which was incorrect. So i was using the wrong root, so ofc i get a wrong diameter (i used “node 1” instead of “node 9”).

Hi,

my solution doesn’t pass the test cases, however it passes all the tests when I submit. I think the problem (or the tests, might be poorly designed)

Hi ! Does anyone know what the “Arbitrary indexes” test is about? This is the only one failing for me, and I have no idea why…thanks!

Hi there, I passed the tests but I see there is “memoization” specified as a hint to this puzzle, I can’t figure out how it would be used here, any idea to share with me?

I can understand that several influence paths will reach a node with different pathSoFar lengths, so stopping the walk when we’ve already reached a node with a bigger previous path length makes sense, but this is more related to caching than memoization, isn’t it?

Well, basically, memoization is a peculiar case of caching. :slight_smile:

Ok ahah, just wanted to be sure I’m not missing anything.

I am sorry. I pass all the recommended test given in the above comments but always cannot pass the test “More complex hierarchy”. I don’t know what the problem is.

Here’s the validator “More complex hierarchy”:

Input:

8
6 4
6 5
1 3
2 1
2 3
5 4
3 5
2 4

Output:

5

3 Likes

Thanks a lot, Thibaud! The test case helped me to solve out the problem.

1 Like

I have also blocked by this test case and then I have recognized that a single author may be influenced by multiple authors (i.e. a single node in the graph might have multiple parents with different path-length).
It would be nice to have a developer test case covering this situation

yes, there should be test cases that are relevant to the validators.
Not sure why it still hasn’t been done.

A new test case has been added regarding the “More complex hierarchy” validator, you should be able to successfully fail this one :slight_smile:.

I confirm, it successfully fails (Several mentors 2 test case) :laughing: :

Console output
Standard Output Stream:

Unable to open output file: No such file or directory
/tmp/Tester.sh: line 8: in4.txt: No such file or directory

Failure
Found: Nothing
Expected: Nothing

EDIT : In fact on this test this behavior is not systematic, but it often happens.

3 Likes

It should be fixed by now :wink:

3 Likes

YEAHH!!! thank you very much sir , my algo is forward & backward searching

Same for me.
Test “more complex hierarcy” fails KO
(1,2),(2,3),(2,4),(3,4),(4,5) gives me 5 as a result OK

I know it’s years later, but thanks, this got me on the right track.
My false thought was that the highest numbered node must be a child, not a parent …

Hi ! i pass everything except for “Arbitrary index”, i read this topic and someone said it was for large number in input, but after some updgrading still doesnt pass. @TwoSteps could u please share the validator so i can test on my machine and debug the code ? Thank you very much ! :slight_smile: