Coding challenge

dunbarx at dunbarx at
Thu Jan 31 12:41:40 EST 2013


I sped-read your comment, and answered generically. You might say that I answered for the number "4", with only "20,10,5,1" as options.

But all the several solutions sent to Mark ran from high denominations to low. So two "3's" would appear before it was ever an issue to load a bunch of 1's. The minimum number of coins was always the result.

Craig Newman

-----Original Message-----
From: Alex Tweedly <alex at>
To: use-livecode <use-livecode at>
Sent: Thu, Jan 31, 2013 9:54 am
Subject: Re: Coding challenge

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 

That's what makes this a more challenging case, but probably without as 
elegant an answer ...

-- Alex.

On 31/01/2013 13:54, dunbarx at wrote:
> Paul.
> As six pennies. As long as you have a "1", you should be OK.
> Craig Newman
> -----Original Message-----
> From: Paul D. DeRocco <pderocco at>
> To: 'How to use LiveCode' <use-livecode at>
> Sent: Thu, Jan 31, 2013 12:57 am
> Subject: RE: Coding challenge
>> From: Mark Wieder
>>> Now how would you do it if the available coin values were:
>>>          40,30,10,4,3,1
>>> That's a more interesting problem, but probably a less
>>> interesting coding
>>> test, because I think it would involve a more brute force
>>> approach, less
>>> elegance.
>> I'm missing something. Why would that be different?
> How would you represent 6?

use-livecode mailing list
use-livecode at
Please visit this url to subscribe, unsubscribe and manage your subscription 


More information about the Use-livecode mailing list