NK ladder problem

I was solving this problem as discussed in the video but I’m getting wrong answer. Someone, please look in my code ans tell me what I’m doing wrong.
Ques: https://www.geeksforgeeks.org/count-ways-reach-nth-stair-using-step-1-2-3/
Code: https://ide.codingblocks.com/s/84552

Hey Shivansh,

Can you please explain me what these lines do?

ios_base::sync_with_stdio(false);
cin.tie(0);

I have modified your code. Have a look at it.

Yeah sure!
I have used them for fast input output.
And there’s also one more mistake in b[] I have changed it you can check it out.

Did it work?
If you don’t mind, Can I connect with you on GitHub or LinkedIn?

There was one more mistake I find it myself in b[].
Yeah sure
Facebook: https://facebook.com/sastava007
Linkedin: https://www.linkedin.com/in/sastava007/

PS: @sastava007 on all sites

1 Like

Hellow, can u plz explain what is meaning of this b vector.
vector b(4);
b[1]=1;b[2]=1;b[3]=2;

As acc. to me b vector should be b[1]=1;b[2]=2;b[3]=4;(as b[3] no of ways to reach 3 ladder through 1,2,3 steps)