we are on the ground meaning n=0. we do not need to take any step to reach there, why ans is not zero ?
Why we are getting ans=1 when n=0?
@premang think it this way that when no step needs to be taken, that means that you have reached the level and this has +1 contribution towards your final answer!
(this is more for sake of recursion/DP to work)
i cant see any meaning to add 1 for no reason
@premang whenever you reach nth step, doesn’t that counts to be one of possible ways?
Also there is no boundation that you should add 1 when n=0 only!
your base cases can also be :
returning …
1 for (n=1)
2 for(n=2)
and 4 for (n=3)
i dont understand that you are saying
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.