Dwarfs standing on the shoulders of giants puzzle discussion

Feel free to send your feedback or ask some help here!

My solution passed all test cases except “More complex hierarchy”
Anyone have any idea how this case is different?
I checked for graph cycles and recursively compute depth.

9 Likes

Hy,

I’ve recently completed this game, i’ve used a simple class to achieve the goal:
The class was containing an integer for the node identification, and a list of nodes, where i’ve stored all the ‘child’ nodes (Basically, a 1-direction linked list). Make a list of from these objects globally, and you’ll be able to do a recursive search till the very last nodes. It’s adaptable for multiple sub-graphs.

I did almost the same thing. I made a HashMap with the node name as key, and a list of the children, and in the end I searched recursiv for the deepest path. But I also didn’t pass the “More complex hierarchy” test. What exactly does that test require from the program?

3 Likes

Hello. I try to help you. I’d submitted this earlier this month. I focused on max length for each new relation read. I explain. I used an object for each node. Each node get following properties : fatherOf array of next nodes, sonOf array of previous nodes, position is the position in the chain. At each new node, I update fatherOf, or sonOf arrays and increment position. I use max position as output. I hope this helps you. Dave

1 Like

i tried this puzzle with 2 completely different algorithms and always get 90% with a fail on “More complex hierarchy”. Is there a way to know if i output a wrong answer or if the process takes too long?

5 Likes

I think there isn’t, but I think you must output the wrong answer. Test files are tiny in the IDE so I don’t think that validation tests are big enough to make your program time out

1 Like

Can we have the in and out values for “More Complex” test case ?

Thanks in advance

10 Likes

There are not enough tests, and the puzzle lacks clarity in the description.
It appears that the complex case = nested paths to the same end.
example given the following sequence
1, 2
2, 3
1, 3
the max length appears to be 2. However since 1 directly influences 3, the 1,2,3 chain appears to be invalid. That is not reflected in the puzzle description, or any test that you have access to. By the definition of the description the 1, 2, 3 chain is the longest, one could even describe it as such.

Author 1 had giants with axes in his story, which author 2 used.
Author 1 had fairy princesses with magic wands, which author 3 used.
Author 2 used giants with axes in his story, and author 3 in his later years also added an axe wielding giant.

The influence chain of 1, 2, 3 is valid, irrespective of the influence 1 had on 3 directly. I would suggest (as above) that you include a complex case test, OR, change the description of the puzzle to reflect that fact.
I tend toward the increase of test cases, because I’ve not figured out yet why I can pass all the tests, and now the complex, but still fail some of the tests in the submission.

  • after finishing I would suggest the addition of two tests, a single relationship, and a nested relationship as above.
20 Likes

Hi all,

It appears we have a bug on the test “More complex hierarchy”. At this point we are not sure what is happening. This is probably a \n problem in our test case.

For example if you fail in Java, you can make the test work by removing the “in.nextLine()” line from the auto-generated code.

We’ll fix and we’ll keep you posted. Sorry!

Hi again,

This is now fixed (missing “\n” on the last line of our test case, this would make the ‘nextLine’ call fail only for some languages including Java).

So Submit, Try Again to reload the question with the corrected text cases and Submit again…

Still not clear what’s wrong with the test case “More complex hierarchy”.

Could somebody provide a test case or explain what the complex hierarchy? I’ve tested two different algorthms. They’ve passed all tests except this one.

2 Likes

hi all, my problem is not about “More complex hierarchy” (which is good for me…) but “Arbitrary Index”

it’s the only one I don’t get green… what does it test exactly?

thanks

I’m still unable to pass the “More complex hierarchy” test in Java. All other tests pass

2 Likes

Worked for me, thanks !

Hi all, I have the same problem where only “more complexity” fails. I’m working in javascript.

It seems to me the example files we have on this puzzle (tests 1, 2 and 3) are fairly trivial and one or two more detailed tests would really help to test our algorithms. Maybe adding “more complexity” to the available ones?

Anyway, Coding(ame) is fun!

1 Like

@int33h: check posts above. There was a problem with one of the validator. Just submit, go back in the puzzle and submit again, it should work.

@b_evieux: check posts above. There was a problem with one of the validator. Just submit, go back in the puzzle and submit again, it should work. Otherwise you may still have a issue with your code.

Yes, we have issues our code, but we can’t understand where is the issue. Personally, I just don’t want to copy-past other people solution. just want to understand where is the bug in my algorithm.

Unfortenelty, test cases and puzzle description leaves some blanks about how to interpret what is the longest way.

People just want to understand what behind of “complex hierarchy” test case.

1 Like

Hi,

From your comment I believe that the validation was fixed (at least for programs in Java).

My program passed all but the “More complex hierarchy” test (29.10. at ~20:30).
Normally I would guess that I have a bug somewhere, but I must ask you: Isn’t it possible that validator for C# programs for this test has similar bug that was just removed from Java validator?

(It is entirely possible that you use the same validator for C# and Java programs and answer for my question is “No”, but I don’t know whether this is so.)

Thank you for information, and THANK YOU for this magnificent portal - I love it!