Minimum number of coin needed to make change

My code not working for the case when it is not possible to make change i.e when it is not possible to make change for the given amount from the given coins denomination please tell me how can i do it
CODE LINK : https://ide.codingblocks.com/s/99373

hey @sunny.kumar2016, there are some small changes on your code. I have made changes to your code. You can check them here https://ide.codingblocks.com/s/99440

https://ide.codingblocks.com/s/99470 for your corrected code the output is still coming wrong for the given output it should come -1 please tell me what is wrong with the code and also explain why the output is coming 214748…

hey @sunny.kumar2016, can you share link to problem statement.