On Tue, Oct 1, 2013 at 10:33 AM, Adam Stevenson <[email protected]> wrote: > Yes, but the problem didn't say I had to read to the problem specifically. > :) >
What the problem *actually* says is that the denominational system is strictly a place-value system of arbitrary base. So all of the denominations will be powers of the base. The example is in base-10, and specifically lists only powers of 10, not multiples of those powers. So, no $20 bills, $0.25 bills, etc. The first step in these kind of interview problems is always discussion to clarify that you understand the problem definition correctly. What is unclear, as far as I have read the definition, is whether the amount to make change for is given to the algorithm in the same base as the denominational system, or whether it's always given in decimal and requires conversion to/from the base for input/output. The latter just adds two base conversion steps to the general algorithm, which is basically giving a place-value interpretation in an arbitrary base to the result of the subtraction of price from payment. /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
