Java NZEC: Bytelandian Gold Coins Problem

hello everyone, I am trying to solve this question using Dynamic Programming and memoization in Java. This is working on this problem

and the problem is that my code is working on my computer, I think may be NZEC is because of the inputs, but don’t know what exactly is the problem, please take a look at this code and let me know my mistake.

thanks a lot in advance for your effort