Question DSA-DP-0046
MediumWhat is the output of this code?
def climb(n):
a, b = 1, 1
for _ in range(n):
a, b = b, a + b
return a
print(climb(10))
- A.
55
- B.
89
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Dynamic Programming question
What is the output of this code?
def climb(n):
a, b = 1, 1
for _ in range(n):
a, b = b, a + b
return a
print(climb(10))
55
89
Sign up free to see the answer and a step-by-step explanation.
144
10