Project Euler: 25 1000-digit Fibonacci Number
This was also not so bad. At least the naive way to do this? I had a method that added two arrays together and returned the number of digits in the sum.
I then used this array to sum the first two terms of fibonacci. The first two terms were saved in the arrays f1 and f2. The result will be saved in array sum. After we’re done, we copy f2 into f1 and then copy sum into f2 and repeat for another iteration until we reach the required the number of digits.
One small optimization I can think of is to avoid copying sum into f2 and f2 into f1 and instead use pointers to these arrays to just figure out which two arrays to sum.