January 2022 enrollments are closed and the course commences on 8th of January, 2022. For future cohorts Join the waitlist

IWGBS Solution



N = int (input());
A = [0,1];
B = [0,1];
i = 2;
while i <= N:
    a = A[i-1]+B[i-1];
    A.append(a);
    B.append(A[i-1]);
    i = i+1;
print(A[N]+B[N]);

470+ Competitive Programming Solutions

If you like what you read subscribe to my newsletter.

I write essays on various engineering topics and share it through my weekly newsletter 👇