3 ms·
Out of curiosity, what's the best solution to this? One thing I noticed is that every loop will pass through an entry less than 100, so you only need to remembe
by cxseven 11y ago
Out of curiosity, what's the best solution to this? One thing I noticed is that every loop will pass through an entry less than 100, so you only need to remember the last 99 numbers below 100 when checking what's been seen-so-far.
You could also precalculate or cache the answer for 1 through 100 to save rerun time.
But maybe a little bit more math would reveal much better optimizations.