Coding challenge

J. Landman Gay jacque at hyperactivesw.com
Thu Jan 31 13:35:31 EST 2013


On 1/31/13 9:43 AM, Mark Wieder wrote:
> Alex-
>
> Thursday, January 31, 2013, 6:53:36 AM, you wrote:
>
>> The question was
>>> Determine the minimum number of coins for change.
>> so the correct answer here would be 2 coins (3+3) rather than 6 coins
>> (1+1+...)
>
>> That's what makes this a more challenging case, but probably without as
>> elegant an answer ...
>
> In any of the submitted examples, replacing the string
> "50,20,10,5,2,1" with "40,30,10,4,3,1" does the right string. No more
> challenging than the original question.
>
> And yes, the minimum number of coins to represent 6 in this case is
> 3+3 and the next in line would be 4+1+1. And then six coins.
>

Actually, after replacing the coin values in my original solution, 
change for "6" comes out:

4=1
1=2

Which is the correct change but not the minimum number of coins.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list