3 Testcases Failing

Refer for code: -

hello @ambuj_0909
your recurrence relation is not correct.
it should be
Find_ways(n,m)=Find_ways(n-1,m)+Find_ways(n-m,m)

base case->
n<m return 1
n==m return 2

@aman212yadav
I modified the code still testcases are not passing
Please look into it

yeah it will not because recursive solution has high time complexity.

apply dynamic programming to pass all test cases.

@aman212yadav
Applied DP approach but still getting Wrong answer for all those testcases.

Refer for code:-

take mod as well(refer output format)

Thanks @aman212yadav
All testcases passed successfully.

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.