Reverse the string first and then reverse individual tokens. So, first we can reverse the whole string as
"It is a fine morning" gets converted to "gninrom enif a si tI" and then reverse each token in the string so that end result would be the desired result. On Fri, Jun 4, 2010 at 8:01 PM, Raj N <[email protected]> wrote: > If I've a string like It is a fine morning, the algorithm has to print > "morning fine a is It" and not "gninrom enif a si tI" > The algo has to do this in linear time. Can someone help me out in this > > -- > 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. > > -- Thanks and Regards Shobhit Bhatnagar DUMCA | 2006-09 -- 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.
