suffix tree is obvsly best..but hard to code at interview!!

On Aug 18, 7:20 pm, DheerajSharma <dheerajsharma1...@gmail.com> wrote:
> O(n^2) i guess..
> We can save all possible substrings..(in two loops it can be done) in
> a hash map..as key..and the value as COUNT..then we can..search for
> the most occurring substring!!
>  u said for non - efficient ;)
>
> On Aug 18, 6:07 pm, MAC <macatad...@gmail.com> wrote:
>
>
>
>
>
>
>
> > A string can have many sub-strings inside it . find the longest substring
> > which is repeated maximum number of times. in case of 2 options repeated
> > same number of times , largest one needs to be ouput and in case same length
> > and same number of times repeated , anyone can be outputted.
>
> > abcdefcbcdfbcdefef  has bcd and ef repeated multiple times but bcd count
>
> > trie apraoch is fine , but in interview difficult to code ,.so definately
> > some other solution is requested . please also give non-efficient , but easy
> > to code solution if any
> > --
> > thanks
> > --mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to