Yes, vikash is right. This will work. Works in O(nm). http://ideone.com/G6RAK
On Sat, Aug 6, 2011 at 1:30 PM, vikash <[email protected]> wrote: > apply longest common subsequqnce problem with a little modification. > that would solve your problem. > > On Aug 6, 12:54 pm, swetha rahul <[email protected]> wrote: > > Hi, > > How to find the longest matching substring in 2 arrays.. > > > > Say we have 2 strings, > > str1="abcdefghi" and str2="iabcdefgk" the answer must be "abcdefg" > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
