What if coin change is not possible. i.e. n = 11 coins are {2, 5}
Coin change problem
in the case u mentioned, it is possible as
2*3 + 5
where it will not be possible will be
amount is 3 and there is a single coin 2, then the loop will surely give the wrong answer, in this particular question it is always made sure that the state is achievable by the given coins
what if n = 7 and coins are {3,5}
yes that is indeed an invalid case, such cases will generally not be tested so do not worry
bt in questions on spoj there is condition for invalid case. then how to deal with it?
can you send me the link once