Complexity of code

in the recursion tree at the base it always find the solution for 0 th step for all ways

@tharun
In the base case when n==0, it just means that the combinations of steps you are typing is a possible one and return 1 will just add up to the ‘ans’ variable.
in case n<0, it means that the combination is wrong so return 0.

You doubt is not exactly cleared to me but i tried to explain the base case.
So if you understood it now then please mark this doubt as resolved.

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.