Using Dynamic programming. Divide array into two parts a and b. Run the minimum edit distance solution for each pair of (a,b)(except this time for b we need to start from the end of the array). Find the minimum among those.
On Feb 24, 10:41 am, sukhmeet singh <sukhmeet2...@gmail.com> wrote: > How do Levenshtein distance used.. For that u need to know the palindrome > that is closest to it.. and if that is know than there is no point in > calculating the distance .. we can easily see how many changes are to be > made..!(correct me if I am wrong) > > Further my approach is this : > taking the number in a string and then I can find the mid point of it. (for > an even number digit i have 2 mid points). Now i can move one pointer to > the left and other to the right to check whether there is a match in the > string , if not i increase the value of cntr by 1 > For eg > 98099 > mid is '0' so mantain to pointers and see that 8!=9 hence cntr+1 > next 9=9 . and we reach the end . > hence answer is 1. > > > > > > > > On Thu, Feb 24, 2011 at 7:36 PM, Balaji S <balaji.ceg...@gmail.com> wrote: > > how to solve it using DP?? > > > -- > > 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. -- 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.