the sample input works fine but why is it giving wrong answerr while submiting the code
Digital dictionary using tries
Hello @Vibhuti0206,
Your Code is failing for the test cases like:
4
pet
peter
rat
rack
8
pe
pet
r
rac
rat
hell
hello
h
Expected Output:
pet
peter
pet
peter
rack
rat
rack
rat
No suggestions
No suggestions
hell
hello
Your Output:
pet
peter
pet
peter
rack
rat
rack
rat
No suggestions
No suggestions
No suggestions
Solution:
Insert the prefix if matching string is not present in the dictionary:
if(!temp){
cout<<“No suggestions”<<endl;
t.addword(str);
}
Modified Code:
Hope, this would help.
Give a like if you are satisfied.
the code is not being submitted
Hello @Vibhuti0206,
I have myself submitted this code before sending to you.
It is passing all the test cases.
Please, try again to submit it.
If it still doesn’t work after trying multiple times then mail your issue to [email protected].
Hope, this would help.