Following is the algorithm to get max number of A's .
it gives number = 20 for n=10


set buff = 0


call get_max(n)


int get_max(int i)
{
    if (i>=1 && i<=3)
    {
        n[i] = i
        m[i] = 'A'
        return n[i]
  }
  else
{
   num_A = getmax(i-3);
   max= MAX(num_A+3,2*num_A, num_A+3*buff)
   n[i] = max


    if max == 2*num_A
     m[i-2] = ctrl-A , m[i-1]=ctrl-C ,m[i-2] = ctrl-V
     buff = num_A
    if (max == num_A + 3*buff)
       m[i]=m[i-1]=m[i-2]='ctrl-v'
    else if (max == num_A + 3)
      m[i]=m[i-1]=m[i-2]='A'


     return n[i]
}
return
}


-- 
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.

Reply via email to