Open ac812 opened 1 year ago
re write exercise Fibonacci recursion in Practical 4 so that it only returns the ith Element of the Sequence not the full sequence - O2 complexity
possible other option: def fibonacci(n): if n==0: return 0 if n==1: return [1] if n == 2: return [1,1] else: prev = fibonacci (n-1) return prev + [prev[-1]+prev[-2]]
re write exercise Fibonacci recursion in Practical 4 so that it only returns the ith Element of the Sequence not the full sequence - O2 complexity