Help me out in this


https://cses.fi/problemset/task/1637

@saurabh1997 help me there ??

@Saurabh are u there ??

yes
let me check your code

@asaurabh_26 my code is giving no output i have used top down approach (recursive+memoization)

if(v[i]>0)add this condition
because
if v[i]=0
suppose n=20
then you call for 20-0=20 again and again and stuck in infinite recursion

@asaurabh_26 still it is giving zero for every case

@asaurabh_26 are u there

MOdified Code

@asaurabh_26 on submitting it on cses only one test cases has been passed

@asaurabh_26 your solution is giving error

i have not done memoization
i only remove segmentation fault error and 0 output error

now i have corrected whole code
and it is also got AC in CSES

Final Complete Code

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.