O(fuck)
this is funny
Math is something computers know how to do. I know how to do For Each loops.
There is a trap in part 2, by the way, that can trip people who try to use maths:
Spoiler
The values are so large that if one uses single precision (32 bit) floating point values, the result will not be correct. Double precision floats yield the correct result.
This means, that doing integer calculations isn’t as bad as it sounds at first.
The naïve and unoptimized version ran in under 4 seconds for me, that’s nowhere near “Time to knuckle down and actually optimize this” territory.
I was so confused just now thinking this was about day 5. Like “What the f do you consider naïve that takes less than four seconds??”
progamming ↑↱ excel
Too scarred from puzzle 5 to do the naïve approach anymore.
Just use dictionaries in Python. Never worry about search performance any more.
I mean, that literally failed just yesterday.
Also I’m not sure where in today’s problem you would even use a dictionary
If you don’t know the meaning of a word, you can literally Google “{The word you don’t know} definition.” Google.com is a really handy and easily-accessed dictionary.