Код: Выделить всё
n = 1
rep = 0
def f(n):
if n == 0:
return 0
if n == 1:
return 1
return f(n - 1) + f(n - 2)
while rep
Подробнее здесь: [url]https://stackoverflow.com/questions/73016953/how-to-reduce-the-running-time-of-fibonacci-sequence-recursive-function[/url]