id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

apcsaRecurCoins


Given a positive total # of cents and an array of coin denominations, recursively compute if the total can be reached using a combination of 0 or more coins of those denominations. Each denomination can be used an infinite number of times.


EXAMPLE: with quarters, dimes and nickels but no pennies, it's possible to make 70 cents but not 71 cents.

HINT: the "smaller problem" is one with a smaller total to reach.

apcsaRecurCoins(70, [25, 10, 5]) → true
apcsaRecurCoins(71, [25, 10, 5]) → false
apcsaRecurCoins(71, [25, 10, 5, 1]) → true

...Save, Compile, Run (ctrl-enter)

public boolean apcsaRecurCoins(int total, int[] denominations) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 450

Copyright Nick Parlante 2017 - privacy