Got run-time erron in test case 1

please elaborate why i am getting run-time error

code link:-

@S18CRX0174
n can be upto 10^4 and total can be upto 10^5. You can’t create dp[10^4][10^5] directly like this. That’s why it is giving runtime error.

so how to implement and what would be the range of dp

@S18CRX0174
create bool dp of same size of use iterative method. Check this code for reference

can you use Collaborate Mode

as i can see your code implements same size i have declared earlier

will use of hasmMap work

@S18CRX0174
I don’t know hashmap would work or not. You should try it. I don’t have experience with java. Try to implement above code as well.