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
I fail at:
- Simple Test
- Dictionnary contains differents words for a same code
- Many possibilities, with small sequence and small dictionnary
- Long sequence, small dictionary
does anyone have an idea on the problem with these test cases.
I’m really stuck and can’t figure out the issue
what tests are you failing? IDE tests or validators (when you submit)?
As for hints, test names seem like relatively good directions to me.
By default, you can suppose that there is no problem with test cases of puzzles solved by thousands of other developers.
the 4 test cases i’m failing are the validator (after submit; all the ide test are passed). lol i’m sure that the test cases are correct i just can’t figure out what’ going on. for the “simple test” all that says is that its simple
for the “dictionnary contains more words for same code” i tested the same situation with the 4th test on the ide.
for the “many possibilities with small sequence” i tested my code with 2 examples given in the posts (look for ‘EEE’) one of them was
for a result of 19
my problem is that i’m not able to think about any case that makes my program fails
so i finally fixed the issue.
i had a bug not reading the last word in the input dictionary word.
fixed that and got 100%.
Thank you _CG_Thibaud for your help.
Could you explain why 19 please ? ( and not 2)
for this :
The codingame markdown editor (now?) formats any sequence of dots with more than three dots into …
..... will become … unless you quote it as code.
I know this is a sad answer, took me some time to realize it as well ;).
Here are two test cases that helped me:
. 2 E EEE
Answer is 1. Looks super basic but I was passing the 4 IDE tests and failing that.
....---- 4 E EE T TT
Answer is 25. With three dots instead of 4 it should be 15.
lol thanks a lot !