Help with error

prob: https://leetcode.com/problems/unique-paths/submissions/

code: https://ide.codingblocks.com/s/421826

the code is working but I wanted to know that why do I have to pass the arguments as n-1 and m-1 and not simply as m and n.

Hello @raghav007 you have to pass the parameters as m-1 and n-1 because the indexing is 0 based so if you m is 3 and you start from 0 then 0 1 2 will constitute for the same number of elements but indexing 0 based so we will compute for final value as m-1 and n-1.

alright but when I make the case as if( m==1 || n== 1) return 1 and I pass in n, and m then it does not gives the right answer

in leetcode you dont have main function with you so there is possibility that might be they are passing m-1 only and then if you are using base case for m==1 then you are not calculating completely you have returned in between only.

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.