Here s the solution from Topcoder.com/tc http://www.topcoder.com/tc?module=Static&d1=match_editorials&d2=srm405
On Fri, Jan 21, 2011 at 12:54 PM, radha krishnan <radhakrishnance...@gmail.com> wrote: > Whats the range of length ? > > On Fri, Jan 21, 2011 at 11:42 AM, snehal jain <learner....@gmail.com> wrote: >> An ideal string is a string where the 1-based index of the first >> occurrence of each letter is equal to the number of occurrences of >> that letter in the string. For example, the “BAOOOA” is an ideal >> string (quotes for clarity only). The letter ‘B’ appears 1 time, and >> its index is 1. The letter ‘A’ occurs 2 times and its first index is >> 2. The letter ‘O’ occurs 3 times and its first index is 3. >> >> Given an int length, return the lexicographical smallest ideal string >> of that length containing only uppercase letters (‘A’-'Z’). If there >> are no such ideal strings of that length, return an empty String >> instead. >> >> -- >> 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.