see the string as S.S` where S` is all but the last char of S. now in this string for all valid char set, find the least weight char say for example a in a-z. Store its positions in hash-map(hash is O(1) fn). Now for each of these positions,call recursively n times, finally set will have only 1 string.. ' Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652
On Fri, Jan 14, 2011 at 2:15 PM, radha krishnan < radhakrishnance...@gmail.com> wrote: > There s O(n) solution for this :) > > On Fri, Jan 14, 2011 at 2:13 PM, radha krishnan > <radhakrishnance...@gmail.com> wrote: > > append the string to original string and > > index=answer of that spoj problem > > now u can ouput the string from index to index+strlen(originalstring)-1 > > > > On Fri, Jan 14, 2011 at 2:12 PM, radha krishnan > > <radhakrishnance...@gmail.com> wrote: > >> wow > >> This s a spoj problem > >> http://www.spoj.pl/problems/MINMOVE/ > >> > >> On Fri, Jan 14, 2011 at 1:40 PM, snehal jain <learner....@gmail.com> > wrote: > >>> Write the code to find lexicographic minimum in a circular array, e.g. > >>> for the array > >>> BCABDADAB, the lexicographic mininum is ABBCABDAD. > >>> > >>> -- > >>> 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<algogeeks%2bunsubscr...@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<algogeeks%2bunsubscr...@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.