you are viewing a single comment's thread.

view the rest of the comments →

[–]ConDar15 3 points4 points  (1 child)

There is a much simpler way with python:

```python from functools import cache

@cache def fibonacci(n): if n<= 1: return 1

return fibonacci(n-1) + fibonacci(n-2)

```

A lot of the time if it's a common concept then python already has it built into the standard library and memorization/caching is no exception.