Implementation of Trie and performing Operations


What is wrong with my solution ??

you have done some mistakes

  1.        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];
            } 
    
    
  2. 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 :heart: and don’t forgot to mark doubt as resolved