Help required in a Trie Problem

Revision en1, by Lakh, 2019-09-17 13:07:59

I am trying the following problem: https://www.hackerearth.com/practice/algorithms/string-algorithm/string-searching/practice-problems/algorithm/lost-in-strings-11fa4a5d/. I am using persistent trie to solve this problem by creating new version of trie for each add operation. For query, I am retrieving prefix count of query string from Rth version of trie and subtracting from this the prefix count from (L-1)th version. But my approach is giving WA. I also went through the editorial but it is not much understandable. So please suggest some other approaches for this problem using trie or some other data structure.

Tags #persistence, trie

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Lakh 2019-09-17 13:07:59 652 Initial revision (published)