Skip to content

Conversation

@thenishantgiri
Copy link

The solution provided in the GitHub repo might need some correction!

we have a dfs function, which has a case for handling the current node isTerminal and if it is terminal, then we're adding the word in the vector that contains our result.

we have a find function that checks whether our tree contains the prefix; if it does, then it calls the dfs function and passes args (address of the last prefix char, address of vector, and word, i.e., the prefix itself)

In the find function, we have also added a check before calling the dfs; if temp/curr is a Terminal, then add it to the vector. line 58-60

Conclusion: There were two checks for the same purpose, and if we pass the same temp, it will repeat the string in the result vector.

Case: if the prefix is also present in the vector word.

Fix: Please remove lines 58-60 or merge my pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant