Getting wrong answer

code is working for other test cases except this one.

Hey @premang can you tell me which test case your code is failing?

its written in the code

In line number 25, before calculating your ans check if your sub prob is not equal to int max
If it’s not equal to int max then only compute your answer of line 25

You can check this code for reference


test case : 15 1 4 it should return -1

15 1 4 are the coins or are the number which you want to make from minimum coins ?
Also can you please tell me what is the set of coins you are using to make any number?

n=15
number of coins=1
4Rs

Since in this code when your are giving an input of 15 1 4 it’s showing 2147483647 it’s nothing but int max , it’s on you that when you encounter such case what do you want to print. Rest the code is correct :slight_smile:

i tried but not working

What’s not working bro?

done thank you dudeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Haha lol let me mark it as resolved. Don’t forget to rate it.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.