Write a recursive algorithm to solve a classic dynamic programming problem, such as the Fibonacci sequence or the climbing stairs problem, and then optimize it using memoization.
Implement the Fibonacci version using fibonacci(n). Return the nth Fibonacci number, where F(0) = 0 and F(1) = 1. Explain why the naive recursive solution is inefficient and how memoization improves its complexity.
def fibonacci(n):