Subset sum easy prob

https://hack.codingblocks.com/contests/c/512/136
recursive code-https://ide.codingblocks.com/s/41124
subset sum is being calculated fine, but due to an empty or null subset, ans is always “yes”, how to recognise and remove the case of empty/null subset?

1 Like

Just add one counter to the boolean function.See this code , i have added one counter in ur code, so whenever i==n then it will return true only if counter >0
https://ide.codingblocks.com/s/41129

1 Like

oh okay, i got it, thank you!