Wrong Answer in all cases

I think my code is correct, but all the cases are showing wrong answer.

here’s the code


both iterative and recursive approach are mentioned
you can ignore the memoisation part in case you are not familiar with dynamic programming yet

but what is wrong with my code? Please explain. Is the output format wrong? Because I think the count of ans is correct.

@Doctor_Insult
A rather silly error
In line 39 cout<<"#"<<test_case+1<<" : "<<count<<endl;

If your doubt is resolved please mark it as closed

thank you sir. I thouhgt it was the ‘n’ which was printed in the sample output. :slight_smile:

1 Like