The Resistance puzzle discussion

A few words on this one. I did a standard recursion with strings matching & memoization to avoid recursion on already-done paths.

Hello everyone,

just a question on test case 2, correct detection of a word.

Input :
–.-------…
5
GOD
GOOD
MORNING
G
HELLO

Expected : “1”

G is in the input dictionnary, so why isn’t it a correct solution ?

Thanks !

Pierre

Because all the symbols must be used?

1 Like

that’s a pretty good reason, thx !

Hey I don’t understand : I cover all the tests that are available in the IDE, including “Long sequence, large dictionary”, but I don’t cover the “Long sequence, large dictionary” in the Submitting section test. I’m stuck at 90%, and my 4th test in IDE takes 883 ms. Let say that the algorithm works. Isn’t 883 ms enough ? Is the 4th IDE test different from the 10th one in the submit section ?

Does this help to make it more clear? MIME Type puzzle discussion

The runtime shouldn’t be the problem if your algorithm passes the “Long sequence, large dictionary” IDE test.

But if it passes the 4th test, why would it fail on the 10th ?

Yes, the tests are different. That’s the whole point.

what happends in this situation :
…-…-…—.-----.-…-…-… (HELLOWORLD)
HE
LLO
WORLD
HELLO

2 possible messages.
HE-LLO-WORLD
HELLO-WORLD

but we have only one “WORLD”

Why does that matter? The puzzle is asking how many possible meanings the message can have, given the list of possible words. There’s no minimum or maximum number of times each word might appear in one message; it’s a dictionary.

is it possible for any of the words to have more than 1 index in the original morse code string?
My program just puts value as morseCode.indexOf().
Will it work? Any help will be appreciated

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. :slight_smile:

8 Likes

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.