3 ms·
If it's fairly easy, then I think it still fits the spirit of the rules. KISS and all. On the other hand, the idea that one might be setting traps is slightly
by fasterpython 6y ago
If it's fairly easy, then I think it still fits the spirit of the rules. KISS and all.
On the other hand, the idea that one might be setting traps is slightly weird... if you _know_ 90% that n will be large then pick an algorithm that's efficient (and since it's easy to implement, it's a win-win). If n is always going to be small, then does the choice really matter?
- naet 6y agoIf N is known small you should favor simplicity and readability over complex optimization.