Leetcode 1013 Solution
This article provides solution to leetcode question 1013 (fibonacci-number)
Access this page by simply typing in "lcs 1013" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/fibonacci-number
Solution
class Solution:
def fib(self, n: int) -> int:
if n == 0:
return 0
elif n == 1:
return 1
a = 0
b = 1
for i in range(1, n):
a, b = b, a + b
return b