We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
we add "facebook" to trie , at this point node->count is 1 .
Next we try to add "face" , in your case it wont add this word , by that i mean the node->count will remain 1 , when i expect node count for nodes f,a,c,e to increment to 2.
so if try to do a substring match fa, yours will always return 1 ,when i expect it to be 2
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tries: Contacts
You are viewing a single comment's thread. Return to all comments →
Well this wont work.
we add "facebook" to trie , at this point node->count is 1 .
Next we try to add "face" , in your case it wont add this word , by that i mean the node->count will remain 1 , when i expect node count for nodes f,a,c,e to increment to 2.
so if try to do a substring match fa, yours will always return 1 ,when i expect it to be 2