Right, the title was misleading.
I still stand by my point though. Compared to other puzzles like temperatures or the descent, it’s way harder for a beginner.
Like you said, it’s your point, and it is made from your perception of what is easy and of your idea of what is a beginner’s knowledge. That’s not the same for everyone…
The difficulty categories of CodinGame are just indicative, there’s no absolute system behind.
I understand it’s just my opinion but even the success rate of the puzzle speaks for itself : 47%
Compare it to the Dolbear’s Law puzzle for example : 83%
Not a big deal anyway, but the puzzles categorization would probably benefit from some work.
I totally agree on that point. But the question is how to sort them… (And if the problem is big enough for the CG team to take care of it…)
When we finish a puzzle we can already give it a star rating, we could also give it a perceived difficulty rank. Each vote would be subjective but the total average rank should be relatively on point.
This needs more visibility. It’s the best suggestion I’ve read about CG all year.
I used your approach (and some graph methods described here), who works fine in 2 first tests, but I have “time out” messages returned by CG in the next tests
Following @nicola post on other thread, I have used ‘graphviz’ Python module which is quite cool, but I cannot import it inside CG :-(( (though it works fine inside my PyCharm IDE)
ModuleNotFoundError: No module named ‘graphviz’
) Is it possible to display on CG output console all input values when there are thousands?.. It is quite frustrating to analyse data without knowing their structure
If you just want to see the inputs, you don’t have to display them. On the top-right of the tests zone there is a list icon which allow you to see the I/O details of each test.
Thanks a lot! I completely forgot this feature in CG, as I had a long break in CG Well I need to calculate the time complexity of my algorithm as it is still running since 10’
I agree.
If a beginner starts with this one, I am sure he will give up coding.
The testcase isnt right
2
0 1
1 2
there are 2 nodes, according to N
but the actual number of nodes is 3
i.e 0 , 1 , 2
this confused me for a while
I agree.
If a beginner starts with this one, I am sure he will give up coding.
Nah, someone who just got introduced to Tree Algorithms could learn from this problem, tho i havent read the graph theory tutorial on this site so unless u meant that…
This can be done in O(N^2) lol
Lemme just summarize my solution
I just use a simple dfs O(N) for each node on the tree(since there is always a unique edge/no cycles) to keep track of the distance of the farthest node from that particular node then keep track of the smallest distances of all the farthest distances from the N nodes.
First, the testcase is perfectly right, since 2 is the number of rods and not of nodes.
Secondly, answering to an old post, which already received multiple answers, just to be sarcastic is not a peculiarly smart attitude…
I’ve tried your way with ‘List’, it doesn’t work (too long for advanced/donut), i try a totally different manner (find the the farest point away, from this point, the farest away, divide by 2, and boom), doesn’t work for donut (too long, don’t know why, and i will face the divide by 4 at a moment, which might be problematic) will try with deque, but learning python by myself, didn’t know ‘List’ where so problematic, even just to add elements!
I realizing by writing this comment that obviously, the dictionary are way better to find an element…
Calling Dijkstra from every node and keeping the minimum-maximum distance passes all the tests and validators