@amit: In this case, we can calculate the length of string S and T and reverse the string whose length is smaller than the other. Then Take LCS of it. To get the final answer.
On Mon, Jul 12, 2010 at 7:05 AM, Amit Jaspal <[email protected]>wrote: > @ above Consider S="anand" T={'d','n'.'a'} > > LCS is "na" but the Answer is "and" . Here the order of characters don't > matter as i have mentioned . > > One way is you can take LCS with every possible permutation of T but that > would be exponential > > > On Mon, Jul 12, 2010 at 3:23 PM, ankur aggarwal > <[email protected]>wrote: > >> i think ques is not complete.. >> otherwise above ans is rite.. i suppose.. >> >> On Mon, Jul 12, 2010 at 10:00 AM, Anand <[email protected]> wrote: >> >>> you can use longest common subsequence algorithm to solve it. >>> >>> http://codepad.org/NDAeIpxR >>> >>> >>> On Sun, Jul 11, 2010 at 9:32 AM, amit <[email protected]> wrote: >>> >>>> Given a set T of characters and a string S , find the minimum window >>>> in S which will contain all the characters in T in complexity O(n) . >>>> >>>> Constraint : The characters may appear in any order >>>> >>>> -- >>>> 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. >>> >> >> >> >> -- >> With Regards >> >> Ankur Aggarwal >> >> -- >> 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. >> > > > > -- > Amit Jaspal > Btech IT IIIT- Allahabad > > -- > 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.
