Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Rafarafa,validated by @_O-MEGA,@cedricdd and @Timinator.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Rafarafa,validated by @_O-MEGA,@cedricdd and @Timinator.
If you have any issues, feel free to ping them.
Thanks, but I was referring to last nightās challenge.
This topic has nothing to do with the yesterday challenge.
Reposting here from the contribution page.
Added two tests, 9 (Actually solvable) and 10 (Actually solvable 2). 9 is mainly for helping to debug and shouldnāt affect anyoneās code, 10ās though may potentially break some. Hereās test 10:
ABCABABC
AB ABC CAB
Expected solution
AB CAB ABC
I saw a very interesting python solution that was only checking two sets of possible prefixes at each iteration (sort of 2 depth search) while passing every test. That wasnāt intended and it should fail now (probably can pass with a 3 depth search but yeahā¦).
If your code doesnāt work anymore Iām sorry.
Still works for me
Itās harder than most easy puzzles. I needed to work hard on the task.
Added: Forgetting to say the main thing - great puzzle!
Anybody had problems on Test 08?
It states it should be Unsolvable, but with original string being āstarstarstarā and the words given āstars tar starā, it should be solvable, right?
Iām outputting āstar stars tarā but no luck.
Given that there is more than one possible solution, the expected output is āUnsolvableā, based on the instruction in the statement:
there are some cases where the original sentence can not unambiguously be deciphered. In those cases print Unsolvable.
Argā¦ Iām stuck with tests 11 and 12
I am solving all test cases and all validators with no backtracking or guessing, only logic. Even in the above example, there is only one place CAB can go. Once that is put in its place, there is only one place ABC can go and then only one place for AB. If no logical placements are available, I assume unsolvable. I havenāt given it much thought but I am wondering if it is possible to have a situation where logic breaks down, but the puzzle is still solveable.
AABABA
A AB ABA
Expected solution
A AB ABA
Should I add it and break more peopleās code
On a side note it wasnāt easy to find.
Why do you think this test would break code, the point is to have multiple positions for each words? The test Repeated is already checking that no?
I think this one would break my code, Iāll output āUnsolvableā.
Because :
there is only 1 word āAā and 3 possible positions,
there is only 1 word āABā and 2 possible positions,
there is only 1 word "āABAā and 2 possible positions.
So I canāt solve the problem.
I ended up adding test 11 (Actually solvable 3ā¦ lol). It should prevent some solutions based on cleverly deducing the positions of the words. You can see the discussion some messages above this one. The test is:
AABABA
A AB ABA
Expected solution
A AB ABA
Sorry to @Timinator, @Remi and every one else whose code broke this time. In my defense this puzzle went through 3 iterations and 3+ months in the contribution section and no one remarked those deficienciesā¦
I believe @Rafarafa is mostly referring to code such as mine that uses logic only, no backtracking. And, yes, just like @Remi suggested, my code is saying āunsolvableā for this new test case. However, I hope @Rafarafa is already working on even tougher test cases because I think I know how Iām going to add logic to handle this new test case. I refuse to use backtracking for this puzzle until I am forced toā¦mostly just because I enjoy the logic.
Logically, āABā and āABAā have no way of covering the very first āAā, so the standalone āAā must cover the 1st āAā. Then, there is only one option remaining for the āABā and one option for the āABAā. I did not think of this either in my original code.
Iāll find a new logic (or not, the puzzle is still finished for me ) but I donāt think this puzzle should stay easy now.