HHC 2019 will be in Reno, Nevada, Sept 21-22
|
09-27-2019, 11:07 PM
Post: #50
|
|||
|
|||
RE: HHC 2019 will be in Reno, Nevada, Sept 21-22
(09-23-2019 01:54 PM)Claudio L. Wrote: My take, nothing clever here, just plain brute force. OK, now it's time to get a bit clever. Below is a version of Wes's brute force, but this time it precomputes all multiplications and powers and stores them in lists. This brings down execution time down to 49 ms (from 68 ms), 27% faster at the expense of some memory. Code:
And talking about clever... here comes David. The code below is identical except it does David's early exit trick, bringing down total execution time now to 35 ms. Code:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 19 Guest(s)