Fibonacci (LeetCode 509)
Implement fib(n), which returns the nth Fibonacci number, where F(0) = 0 and F(1) = 1. The function takes an integer n and returns an integer; for example, fib(4) returns 3. Constraints: 0 <= n <= 30.
def fib(n):