all the solutions mentioned above are not complete
1)need to solve this problem with sliding window concept 2)its O(n) On Wed, Aug 11, 2010 at 2:43 PM, Algoose chase <[email protected]> wrote: > @ Anand, No , It doesnt > > Try with String2 = "LH" > String1 = "HELLO". > I think LCS solves a different problem from the one being asked here. > > I think we must generate all possible combination of strings and for each > combination , check if all chars from str2 is present in it. > > On Sun, Aug 1, 2010 at 11:54 PM, Anand <[email protected]> wrote: > >> >> Even if they are not in the same order still it works >> >> http://codepad.org/jpCUqwpA >> >> <http://codepad.org/jpCUqwpA> >> On Sun, Aug 1, 2010 at 10:52 AM, srikanth sg >> <[email protected]>wrote: >> >>> dude they dont need to be in the same order .. >>> how are taking care of that >>> >>> >>> On Sun, Aug 1, 2010 at 10:47 AM, Anand <[email protected]> wrote: >>> >>>> Using Dynamic programing(Longest common subsequence logic) we can solve >>>> this problem in O(nm) where n is the length of the first string and m is >>>> the >>>> length of second string. Last element of matrix which the length of the >>>> string that matches. >>>> >>>> http://codepad.org/cyiKEMSF >>>> >>>> <http://codepad.org/cyiKEMSF> >>>> >>>> On Sun, Aug 1, 2010 at 8:13 AM, srikanth sg >>>> <[email protected]>wrote: >>>> >>>>> plz .. if any one knows dp solution then tell ... >>>>> >>>>> >>>>> On Sun, Aug 1, 2010 at 7:31 AM, Ashim Kapoor <[email protected]>wrote: >>>>> >>>>>> I am not sure, but can I do this using a suffix trie ? any comments ? >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Sun, Aug 1, 2010 at 2:29 PM, Ashish Goel <[email protected]>wrote: >>>>>> >>>>>>> solution could be to find the charcter position from both sides for >>>>>>> each char of s2 >>>>>>> then from the 2*n array, find the smallest index from left and >>>>>>> largest from right, within these two indexes all chars would be there >>>>>>> >>>>>>> one case where one of the chars can be missing can be found if a row >>>>>>> in this 2-d array remains unmodified >>>>>>> >>>>>>> >>>>>>> >>>>>>> Best Regards >>>>>>> Ashish Goel >>>>>>> "Think positive and find fuel in failure" >>>>>>> +919985813081 >>>>>>> +919966006652 >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Sat, Jul 31, 2010 at 10:22 PM, Nikhil Jindal < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> At the moment, I can only think of an O(n^3) algo. >>>>>>>> Maybe if you can find a hash function which computes the hash value >>>>>>>> depending on the unique characters the string contains, you can reduce >>>>>>>> it to >>>>>>>> O(n^2). >>>>>>>> >>>>>>>> >>>>>>>> On Sat, Jul 31, 2010 at 7:09 PM, srikanth sg < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> given two string , find the minimum width in string 1 containing >>>>>>>>> the >>>>>>>>> all characters of string 2 , they may present in different order >>>>>>>>> string 1-HELLO >>>>>>>>> string 2- LE >>>>>>>>> answer-2 >>>>>>>>> >>>>>>>>> -- >>>>>>>>> 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]<algogeeks%[email protected]> >>>>>>>>> . >>>>>>>>> For more options, visit this group at >>>>>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>>>>> >>>>>>>>> >>>>>>>> Please access the attached hyperlink for an important electronic >>>>>>>> communications disclaimer: >>>>>>>> http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> >>>>>>>> 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] >>>>>>>> <algogeeks%[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]<algogeeks%[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]<algogeeks%[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]<algogeeks%[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]<algogeeks%[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]<algogeeks%[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]<algogeeks%[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]<algogeeks%[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.
