Plight Of The Fellowship Of The Ring - last test '5' is failing

I passed all the 5 tests, but when I submit the code, ‘5’ test is failed.
Can someone explain me and give me any clue why it is happening?

I know that it was design to prevent hard coded solutions, but it useful, not informal.
It might be a bug in the puzzle.

I have the same thing but for test ‘1’… It’s more likely that there’s some edge case in our code that our solution doesn’t handle, rather than a bug in the puzzle - but there’s no way to know what that edge case is…

I also had a problem with Validator 1.
It checks if you consider that you can’t reach a spot if number of moves is greater or equal to distance from the starting point of an orc to that spot.

For below input, your solution should answer with “IMPOSSIBLE”:

2
1
1
1 0
2 0
2 1
0 1
0
1

That’s awesome! Fixing that one broke a few of my regular case, but it was nothing a little spaghetti code (for the edge cases) couldn’t fix. Thanks!

Is the problem fixed, or do you want me to look into it?

eulerscheZahl really helped me and gave me a clue to “look backwards for some routes”

You should keep in mind that you should always visit closes indexes in the beginning, in my case the order of indexes were mixed in linkedList so I was visiting not the closest index.

1 Like