+ 1
Can anyone help me to solve the challenge I'm getting some error and can't able to decode that?
Here is the challenge code which I've tried https://www.sololearn.com/post/241300/?ref=app https://code.sololearn.com/csprLkXF0VVF/?ref=app
2 Answers
+ 5
The first strange thing in your code i notice is :
root = Trie()
You're creating the same object multiple times in a loop with no reason.
Then, you're not using the class methods the proper way:
insert(root, word)
should be:
root.insert(word)
and similarly,
find(root, query)
should be :
root.find(query)
+ 5
I am confused, why are you using a class? Also, you are using class methods without even defining an object... why not use function to make it easier?