Home > Software design >  Count of subsetsum problem, how to debug where the solution is not working?
Count of subsetsum problem, how to debug where the solution is not working?

Time:09-17

So I'm trying to solve enter image description here

I don't know on how to proceed in solving this problem at this point. Ideally according to the code I have written the input is within the grasp of the code and output should've been correct but unfortunately it is not the case. I wanted to ask if someone could spot on where the problem might be in the code or guide me on how to debug where the problem is in the code.

CodePudding user response:

You are probably encountering integer overflow along the way.

You are taking the mod only right before ending the function, but your cache is of type int, so when placing too big numbers - you are losing some data due to overflow.

  • Related