[algogeeks] Amazon - max substring

2011-06-29 Thread Swathi
Given a string (assume there no spaces or punctuations), write a code that returns the max. length of the string that has repeated more than once. Thanks, Swathi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Piyush Sinha
i think suffix tres will do the job if i have not misunderstood the question... On 6/29/11, Swathi chukka.swa...@gmail.com wrote: Given a string (assume there no spaces or punctuations), write a code that returns the max. length of the string that has repeated more than once. Thanks, Swathi

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Swathi
It does but i am asked to code.. if you know the code for suffix tree then please provide.. On Wed, Jun 29, 2011 at 10:30 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: i think suffix tres will do the job if i have not misunderstood the question... On 6/29/11, Swathi chukka.swa...@gmail.com

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Piyush Sinha
I dnt think any company is gonna ask u to code suffix tree..:P :P On 6/29/11, Swathi chukka.swa...@gmail.com wrote: It does but i am asked to code.. if you know the code for suffix tree then please provide.. On Wed, Jun 29, 2011 at 10:30 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: i

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Swathi
I dont know why people reply in plain words.. I personally had this experience and i was asked to code but i couldn't On Wed, Jun 29, 2011 at 10:53 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: I dnt think any company is gonna ask u to code suffix tree..:P :P On 6/29/11, Swathi

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Ashish Goel
chk this and try to write urself http://www.allisons.org/ll/AlgDS/Tree/Suffix/ people hv right to decide if they want to WAP or not. Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Wed, Jun 29, 2011 at 10:55 PM, Swathi chukka.swa...@gmail.com

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Swathi
I never said you don't have right but even after saying they asked me to write the code.. you are asking the same question which is not at all good.. On Wed, Jun 29, 2011 at 11:01 PM, Ashish Goel ashg...@gmail.com wrote: chk this and try to write urself

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Piyush Sinha
jokes apart...then i think it can be done using dynamic programming using the similar approach of LCS but the time and space complexity both will be N^2.i am working on the pseudocode and post it within a few moments if it works.. On 6/29/11, Swathi chukka.swa...@gmail.com wrote: I dont know

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Ashish Goel
how abt two passes first one makes a multi map of char and its positions second one a bit tricky to eg abcabcabc first pass a,0,3,6, b,1,4,7 c,2,5,8 second pass first char is a, its next position is 3(find thrugh the map) repeated substring can be of length 3 for loop with this