Indeed it seems possible, and the exponential count of re-arrangements is where this puzzle earns its seat in the Very Hard ranks. Care needs to be taken in order to avoid recalculating expensive operations.
~34 ms in Python3 for the last test case. struggled a lot until i discovered identical sequences could be different words.. simple recursion with memoization.
Well, it took me three months and fifteen submits. It got to around 120ms for the last test case in C++ (my solution turned out to be somehow similar to Agade's).
Throughout the three months, I've read through this entire thread multiple times. There were, of course, some discouraging posts up there amidst the ones that were actually helpful.
This puzzle wasn't entirely easy for me but I'm happy that it wasn't easy - the process to get to the end was exhilarating.
If you're stuck, persist; and if you haven't started the puzzle already, do start and try it out.
Is there anyone that can help with some hints on how to solve this. I am new to coding and trying to solve this in Haskell. I have been banging my head against the wall trying to get past the fourth test (LSLD).
any chance you could help with how you solved it?
There's a few posts in this thread with hints. The big one that got me to 100% was saving the outcome at each stop, so if I found myself in the same position again I wouldn't have to re-parse the path. I left a post in April '16 explaining it.
Does the rust compiler is enable with optimisation ? Because I get a 2200ms for the "Séquence longue, grand dictionnaire" with debug mode on my laptop and I get a 53ms with release mode (enable optimisation when compiling). I also use the same code ported in Kotlin and it succeed on all the tests.
No release mode for puzzles.
Ok thank's for the answer
In the core of the problem, there is a really simple mathematical solution