What is wrong with my solution ??
Implementation of Trie and performing Operations
you have done some mistakes
-
if(temp->children.count(ch)){ return false; }else{ temp=temp->children[ch]; }
this is wrong correct one is
if(temp->children.count(ch)==0){ return false; }else{ temp=temp->children[ch]; }
-
in the function bool startsWith(string prefix) {
at end you have to return true
after these modifications your code will get AC
Modified Code
if you want to ask something about this feel free to ask
i hope this helps
if yes show your response with and don’t forgot to mark doubt as resolved