My code gives the right output but is not getting accepted


this is my code and gives the right output for the test cases.
Please check once.

hello @amanb25
use dynamic programming . because recursive solution might fail because of high time complexity.

I haven’t learned that yet. This question was in the recursive section challenges, so I’m looking for an answer that uses recursion.

sorry bro but recusive solution will not pass the testcases.
try again after getting familiar with dp