ProjectEuler problem 35
    Stewart Gordon 
    smjg_1998 at yahoo.com
       
    Sat May 19 05:40:18 PDT 2012
    
    
  
On 16/05/2012 10:46, Dmitry Olshansky wrote:
<snip>
> Don't ever do that. I mean allocating memory in tight cycle.
> Instead use circular buffer. (just use the same array and wrap indexes)
<snip>
You might as well not use a string representation at all.  At the beginning of the loop, 
calculate the number of digits in n, then pow10 = 10 ^^ (digits - 1).  Then cycle with
     n = n / 10 + (n % 10) * pow10;
Stewart.
    
    
More information about the Digitalmars-d-learn
mailing list