[Community Puzzle] Is that a possible word? EP1

https://www.codingame.com/training/easy/is-that-a-possible-word-ep1

Send your feedback or ask for help here!

Created by @Tee-Resa,validated by @Djoums,@Crypticsy and @TwT.
If you have any issues, feel free to ping them.

Hello, thanks for this puzzle.
I have a problem, I passed all the test cases in ide 100%, but when I submit the 3rd validator fails so I don’t know what to do now because I verified my code many times and I don’t know what is wrong in my solution

Apart from the endstates, the third test case and the third validator are identical. So you could try to use the third test case as input and check if all calculated endstates are correct.

2 Likes

yes I found my error thank you

ep1 implies there is/will be a second episode?

Hey, I’m failing Validator 4, and I have no idea how to improve my code - any hints?

It is the same as Test 4 except for the allowed final states, so you may try testing your code by varying those.

I’ve checked all the combinations of allowed final states and it seems to produce right output. What else can I do?
Some ppl post their code in this forum but it’s not the right way to go?

What combinations did you check and what outputs did you get? I can compare my results with yours.

This are scenarios that I tried for test 4:
1

[]
false
false
false
false
false
false

2

['A']
false
false
false
false
false
false

3

['A', 'B']
false
false
false
true
false
false

4

['A', 'B', 'C']
false
false
false
true
false
false

5

['B', 'C']
false
false
false
true
false
false

6

['A', 'C']
false
false
false
false
false
false

7

['C']
false
false
false
false
false
false

My answers are different from yours for #4 to #7:

4 & 5

['A', 'B', 'C'] / ['B', 'C']
true
true
true
true
false
false

6 & 7

['A', 'C'] / ['C']
true
true
true
false
false
false
1 Like

I found error in my code. Thank you @5DN1L for helping me on this one.

Spoiler

I thought that if there are no transitions for given state then we shouldn’t add it to “state machine”, that caused my code to fail on validator 4.

2 Likes

A validator for the case " If you are in a state and get a character that is in the alphabet but no transition, also return “false”" is missing. I was able to pass all validators but validators 3 and 4 failed after I submitted my code because I didn’t cover this case.

Hi could someone confirm this? Failing validator 3 (ty for previous test 4 post)

This are scenarios that I tried for test 3:
1

[]
false
false
false
false
false
false
false

2

['A']
false
false
false
false
false
false
true

3

['A', 'B']
false
true
false
false
true
false
true

4

['A', 'B', 'C']
true
true
true
false
true
true
true

5

['B', 'C']
true
true
true
false
true
true
false

6

['A', 'C']
true
false
true
false
false
true
true

7

['C']
true
false
true
false
false
true
false

Assuming you’re changing the line of “allowed final states”, my answers are different from yours for #2 to #6:

2      3           4 / 5                         6
['A']  ['A', 'B']  ['A', 'B', 'C'] / ['B', 'C']  ['A', 'C']
false  false       true                          true
false  false       false                         false
false  false       true                          true
false  false       false                         false
false  true        true                          false
false  false       true                          true
false  false       false                         false
2 Likes

the data are always valide? in the test 4, i have number_of_words that is 0. and if i try bypass i find 0 word with getline?
my inputs.
a b c
A B C
A a A
A b B
B a B
B b A
B c C
A
A
0
i found it’s because i used char start_state;
cin>>start_state;cin.ignore();
char end_states;
cin>> end_states;cin.ignore(); and not string start_state;
getline(cin, start_state);
string end_states;

What do you mean? If you use the default starting code:

    cin >> number_of_words; cin.ignore();
    for (int i = 0; i < number_of_words; i++) {
        string word;
        getline(cin, word);
    }

Then the lines inside the for-loop won’t be executed at all when number_of_words = 0.

very helpful to find the good coding