Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
That is not true. I can easily modify my solution so it will take variable array of divisors. In that case the complexity would be O(m), where m is the divisor's count. And your solution would be O (n * m), where n - input number.
World is amazing. Yesterday it was rain and now it's snow. Of course if you prefer snow :)
I made my remark about this solution because it was marked as "Best practice". I assume that "best practice" solutions should be realy best practice and not just an "okey". For example if some task can be done in O(n) time than O(n^3) so it hardly could be "best practice" just because it solves the task.
Well, I see no problem writing readable and maintainable solution that is also fast. Most of the tasks here can be done super easy using bruteforce. However fast solutions requires some time, knowledge, thinking and so on. If someone will be asked question like this one in job interview and writes down bruteforce solution he will be asked to write smth faster or will he be rejected.
Answered in solution above.
Yeah, but using "people" table, when in fact you don't have to, looks like a bug for me :-) Take it easy, I want to make this world better and solutions too as well, that is all.
Not so great solution because we don't need to use people table at all
Not so great solution because we don't need to use people table at all
Bad solution, we count array keys every iteration
Bad solution. It's math kata and could be resolved without iteration.
It's not best practice at all. The complexity of this solution is O(n), however there are exists solution with complexity O(1). Simply put, we don't have to iterate through array we can just use math.
It can't be best practice, because we don't need to iterate the whole array. We only need to search for "Parity Outlier" and that's it. We should stop searching after it.