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.