An interesting programming challenge

dunbarx at aol.com dunbarx at aol.com
Thu Apr 9 22:35:59 EDT 2015



Here is another. it was posted on this list a few weeks ago by fareastern23. but was never taken up by anyone:


The 2010 Census puts populations of 26 largest US metro areas at 18897109, 12828837, 9461105, 6371773, 5965343, 5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313, 2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, and 2134411. 

Can you find a subset of these areas where a total of exactly 100,000,000 people live, assuming the census estimates are exactly right? Provide the answer and code or reasoning used.


I ran up against a memory limit in my solution, below what are purported to be LC limits.  It engendered a bug report, which was in fact valid, I had to write a kluge around that issue. But going back to the problem, it may simply mean I am not terribly clever in my methods.


I may be wrong, but I think there is no solution.


Craig


-----Original Message-----
From: Jerry Jensen <jhj at jhj.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Thu, Apr 9, 2015 10:05 pm
Subject: Re: An interesting programming challenge



> On Apr 9, 2015, at 3:33 PM, Geoff Canyon <gcanyon at gmail.com> wrote:
> 
>
https://brilliant.org/problems/the-clever-cat/?group=sigjT0HDmvgp&ref_id=713367
>

> Happy to say that the code I wrote gave the correct answer the first
time,
> so yay.
> 
> I'll post my solution in a reply to make it easier to
avoid spoilers in
> case anyone wants to try it themselves.
> 
> gc

Just
for fun, I tried my solution on LC 5.4.5 with all else being equal:
LC 6.7.4
around 100 msec
LC 5.5.4 around 115 msec
Both those numbers varied around +/-
5 msec on multiple
runs.
.Jerry


_______________________________________________
use-livecode
mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe,
unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 




More information about the use-livecode mailing list