class Solution(object):
def fib(self, N):
"""
:type N: int
:rtype: int
"""
a, b = 0, 1
while N > 0:
N -= 1
b = a + b
a = b - a
return a
class Solution(object):
def fib(self, N):
"""
:type N: int
:rtype: int
"""
a, b = 0, 1
while N > 0:
N -= 1
b = a + b
a = b - a
return a
本文标题:509. Fibonacci Number [Easy] 斐波纳
本文链接:https://www.haomeiwen.com/subject/rulotctx.html
网友评论