Hi, inside the function fib, the condition should check if the input is less than or equal to 1, instead of equal to 0 and return n. for input 1 the current code returns 0 instead of 1.
correct code:
if (n <= 1)
return n;

Type your question above this line.


Hello @Yerramsetty_Ganesh_D,

Yes, you are right. It should return 1 instead of 0. We have updated the course.
Thank you for pointing it out.

1 Like