Finding Fibonacci numbers using linear algebra
gitlab.com
gitlab.com
You can compute the nth fibonacci number in O(lg n) additions and multiplies. That indeed doesn't turn out to be a good model for how long it takes on an actual computer though.
return fibonacci[k]
This is the canonical benefit of memoization, further clarified by this quote: "This solution has an O(k) space and time complexity for the first query."I mean they would be able to deduce it, but they just never made the connection.