substrings and subsets are two different things.....
If you want an easy solution brute force it...:)
Its not that difficult to code  a suffix tree if it makes you a
millionare....:)

On Thu, Aug 18, 2011 at 7:59 PM, Arun Vishwanathan
<aaron.nar...@gmail.com>wrote:

> am just asking but how can u get all possible substrings in O(n square)
> time when there are 2 power N of them actually?
>
>
>
> On Thu, Aug 18, 2011 at 4: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.
>>
>>
>
>
> --
>  "People often say that motivation doesn't last. Well, neither does
> bathing - that's why we recommend it daily."
>
>  --
> 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.
>



-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
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