Premium Content - Free Preview
In the Kingdom of Zumbania, the Currency printer can only print the digit
1. Thus they have 3 different denominations:
111. You need to determine if you can reach a certain sum with a given set of coins.
You will be given a line of input (as an array) consisting of 4 integers for the number of 1-coins, 11-coins, 111-coins, and the desired sum.
For example, the input
1 2 3 356 means there's
3 111-coins and a desired sum of
End of Free Content Preview. Please Sign in or Sign up to buy premium content.
Florian KMay 26, 9:37 AM
shouldn't the 3rd Test Input be true too? 3 (3*1) + 33 (3*11) + 333 (3*111) = 369
LearnerooMay 26, 9:39 AM
@Florian, you need to select the correct change exactly. 369 is not equal to 365, and there's no way to get 365 with those coins.
Patrick LuJul 1, 6:23 PM
I have a solution but I think there is a better way to do it. Is there a solution that we can see?
LearnerooJul 1, 7:27 PM
@Patrick Lu, I added a featured answer, see also the Learneroo blog.