in reply to Golf: Buying with exact change
Or, when a $1 denomination is used, all values can be represented. In this case, the solution is undefined, so you can return anything you like (or even loop forever).Why is the solution undefined if a $1 denomination is used? I'd say there's an obvious answer: 0.
|
---|