re: Project Euler #2 - Even Fibonacci numbers VIEW POST

VIEW FULL DISCUSSION
 
def fibonacci(num, prev_num, sum=0):
    print(num, prev_num, sum)
    if num % 2 == 0:
        sum += num
    if num < 4000000:
        return fibonacci(num + prev_num, num, sum)
    return sum


print(fibonacci(1, 1))

Uses recursion, can someone explain how to calculate the complexity?

code of conduct - report abuse