I wish to transform the basic Fibonacci function:
int find_fib(int fib_to) {
if (fib_to == 0) {
return 0;
}
else if (fib_to == 1) {
return 1;
}
else {
return (find_fib(fib_to - 1) + find_fib(fib_to - 2));
}
}
into one that would use only ONE recursive call. I searched up many sites that tells me to store the value found by (find_fib(fib_to - 1) + find_fib(fib_to - 2)) into some array and then make use of the array, but doing so requires 2 recursive calls.
Any tips on how to solve the problem?