got it.there was some logical error , i found it out.thanks in advance. On Tue, Dec 14, 2010 at 9:06 PM, Ankur Khurana <ankur.kkhur...@gmail.com> wrote: > the question exactly was to find next palindrome just greater than the > given no. The number could have a million digits. > > On Tue, Dec 14, 2010 at 9:01 PM, Ankur <ankur.kkhur...@gmail.com> wrote: >> hi, >> i was doing this problem : >> http://www.spoj.pl/problems/PALIN/ >> >> and i dont know why my solution was not giving AC . i have applied a >> simple strategy.if no. of digits are even , then mirror the first half >> and then add it to the first half. we get the plaindrome.if it is same >> as the given no. then just increment the first half and mirror it and >> add it to the first half again.Now also , the digits can be like this >> 9999 or 999999 .I have made sure to treat this as a special case and >> my output for these is 10001 and 1000001 . I have applied a similar >> strategy for odd no of digits by increasing the middle elemnt and >> amirroring the first half around the middle element. >> here is the link to my solution >> >> http://paste.ubuntu.com/543644/ >> >> I would appreciate if anybody could help me here. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algoge...@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 algoge...@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.