Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
[QUIZ] Weird Numbers (#57) Solution
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Ryan Leavengood, post: 4495125"] Well something had to generate those answers in the first place, and for that I'd take my, Rob, or Edward's solution any day. Well I certainly debugged mine by looking at the pre-existing list, which was useful. But the fact that his list was missing things really caused me pause, because if someone depended on that list to be accurate, they would be in trouble. Yes but his brute-force algorithm is extremely slow, and his list is wrong. Of the three fastest solutions so far (Edward's, Rob's and mine), all continue to generate answers at a similar rate, consistently. For example, to generate up to 100000, the time was 16.687, 17.281 and 18.469 seconds (in the order listed above, i.e. mine is slowest.) Since there are 204 weird numbers between 0 and 100000, each algorithm generates about 11-12 per second. Well I've probably come off as mean to Hampton, and I don't really want to come off that way either. But it does rub me the wrong way to have someone call their solution fast when the solution is WRONG. His caching optimization is certainly a good idea (and fairly obvious), though it would be better if it actually generated the cache and reused it so that subsequent runs got faster. I may code up something like this. Ryan [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
[QUIZ] Weird Numbers (#57) Solution
Top