4 ms·
Damn, I have to go in to work early today or I could continue this. The first one only took a minute or two of coding to solve in Perl. The search string was
by Natsu 16y ago
Damn, I have to go in to work early today or I could continue this. The first one only took a minute or two of coding to solve in Perl. The search string was several times longer than my code, even with use warnings & use strict in there.
I'd write a bit of code to memoize the function before I'd do the Fibonacci numbers, though, and I just don't have time to continue right now, even though it's pretty easy. Are the rest of the tests like that? Do they force you to use more efficient code, rather than simpler brute force tests so that your code has a decent runtime?
- Tichy 16y agobrute force seems to be sufficient
- leif 16y agoyou also probably don't want to memoize, you aren't going to re-use, so why waste the memory?
- Natsu 16y agoI wrote that right before leaving for work, so I hadn't spent any time thinking about the problem. Coming back, I see that I really don't need to be very efficient for any of these problems, which I honestly find a little disappointing.