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.
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.
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
I found error in my code. Thank you @5DN1L for helping me on this one.
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.
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
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
Why do we need these two lines to be read:
Line 1: A string input for the alphabet which can lead to changes in state, separated with space
Line 2: A string states for the possible states, separated with space
If the transitions and the start and the end states fully describe the machine.
OTOH,
Constants should be applied here for more clarity in exampleâs explanations
According to the corresponding transition ( A a B ), you move to state B.
You are now in state B. The next character found is a âbâ. According to the corresponding transition ( B b A ), you move to state A.
Back in state A. The last character found is a âcâ. According to the corresponding transition ( A c B ), you move to state B again.
The word is over, the final state is B. This is in the set of the allowed final states (endStates), so the word âabcâ is valid, and you print âtrueâ .
Should have mentioned the format of transition as in
Next numberOfTransitions lines: A string transition for the transition from one state to the next, in the form of [State] [lowercase letter] [State]
Output should have mentioned
Next
numberOfWordslines âŚ
Constraints should have mentioned both startState and endState are always part of states
Should have also mentioned word will always be lowercase letters