Leetcode DP question

problem code–> https://leetcode.com/problems/climbing-stairs/

my solution–>


plz tell me where is my code wrong ??

Hey @coderajay03

   if(n<0)
            return 0;
        
        if(n==0)
            return 1;

Do this, if this doesn’t help, let me know.

made the changes still getting error plz see

minor mistake

dp[i]=-1;     //updated

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.