4 ms·
> Isn't this like... really, really basic? Yeah, it's reasonably basic. For the problem as stated where there are only 1000 numbers to iterate over, though, I
by its_dario 7y ago
> Isn't this like... really, really basic?
Yeah, it's reasonably basic. For the problem as stated where there are only 1000 numbers to iterate over, though, I wouldn't have bothered wasting time thinking about it when the naive implementation is fast enough that it doesn't matter.
Why start with something more complicated (assuming you're going to program it rather than just solving it outright on paper) when the simple way works?