Help me out in this
yes
let me check your code
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
MOdified Code
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.