you can do it easily by counting the number that can be formed with 1 digit = 26, then 2 digit = 26*26... similarly find the length of the answer and then can find the number by searching using bsearch over the number of different characters.
if someone can do it with base % method,, then it is great :-P On Thu, Aug 16, 2012 at 11:19 PM, Wei.QI <[email protected]> wrote: > @yq, didn't I ask you this question before? > > On Fri, Aug 10, 2012 at 4:48 PM, yq Zhang <[email protected]> wrote: > > @shiv, your code is correct go compute the base 26 number. However, this > > question is not base 26 number obviously. > > > > > > > > On Wed, Aug 8, 2012 at 4:46 AM, shiv narayan <[email protected]> > > wrote: > >> > >> this is similar to conversion of no in base 26.( where digits are > >> a,b,c,d...z) just think it like decimal to binary conversion here base > is > >> instead 26. > >> > >> char Carr[26]={a,b,c...z} > >> i=0; > >> int arr[]; > >> do > >> { > >> arrr[i++]=n%26; > >> n/=2; > >> } > >> while(n) ; > >> for(int i=n-1;i>=0;i--) > >> cout<<Carr[a[i]]; > >> > >> correct me if i am wrong. > >> On Wednesday, 8 August 2012 12:56:56 UTC+5:30, ashgoel wrote: > >>> > >>> Imagine a sequence like this: a, b, c...z, aa, ab, ac...zz, aaa, aab, > >>> aac.... aax, aaz, aba, abc... (Its same as excel column names). Given > an > >>> integer (n), generate n-th string from the above sequence. > >>> > >>> > >>> Best Regards > >>> Ashish Goel > >>> "Think positive and find fuel in failure" > >>> +919985813081 > >>> +919966006652 > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Algorithm Geeks" group. > >> To view this discussion on the web visit > >> https://groups.google.com/d/msg/algogeeks/-/Z3kYiTZi_F8J. > >> > >> 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. > > > > > > -- > > 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. > > -- > 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. > > -- 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.
