Sort 13 Discussions, By:
Please Login in order to post a comment
The first case in the example says: "The cities in the order of visit is 4 - > 8 -> 3 -> 8 -> 4 -> 8 -> 3". Shouldn't this be 4 -> 8 -> 3 -> 8 -> 3 -> 8 -> 4? After the second visit to 8, both 3 and 4 are candidates and both have been visited once, shouldn't the lowest index then be selected (i.e. 3 instead of 4)?
I've just opened up and read editorial and I found the way problem is stated is misleading to programmers who are not aware of undirected graph corollaries.
For example these two statements are irrelevant to the solution because any traversal after the query node is irrelevant and the distances are equal to max distance between any two nodes in graph.
There might be more than 1 such cities. In that case, Fedya will choose a city that was already visited as less times as possible in this journey.
There still might be more than 1 such cities. In that case, Fedya will go to the city with the smallest number.
This problem , is diverging the candidate from focusing on actual problem. For example the statements that Fendya travels to the farthest point dependency of frequency of vists and small no of the node, it carries away from the main idea of dp optimization
In the result of a test case 2 there are values larger than max int and method is returning an int array by default. I am getting a conversion from long to int in C# as a result and it would be correct in my case if the output is long array but is not. How it can store 11 digits in an integer?
My java code is OK: 12 tests passed. And I bought test case 14: the test case succeeds on my laptop but not on hr. Seems the same for tests 13 and 15. Can someone help ? my submission is https://www.hackerrank.com/challenges/journey-scheduling/submissions/code/15139372 Thanks