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.
1 x 1 = 1, that is why it should be in there. The number and itself happens to be a divisor. There's also no special criteria that says the array of divisors has to be unique.
The example provided in the description of the kata for the number 246:
[1, 246, 2, 123, 3, 82, 6, 41]
1 x 246 = 246
2 x 123 = 246
3 x 82 = 246
6 x 41 = 246
Makes sense, since all the numbers are in the array.
When we try to produce the first step for number "1":
1 x 1 = 1
It should produce [1,1].
Can you mention why it shouldn't be [1,1]?
It got marked as Best Practices, but here the idea is to solve it yourself instead of using libraries...
This comment is hidden because it contains spoiler information about the solution
Probably the best solution here in terms of algorithm. The one that got upvoted the most looks prettiest.
Blows my mind everytime I see a short solution like this.
short solution is what I would say, but not Best Practices. Does not scale well if one list is a lot longer than the other one. It would store too much into the memory.
From my understanding, your "copy" just means creating separate memory address, and not referencing to the original object directly.
Your instructions can be challenging for those without CS major.
I actually never knew this. This is about 25% faster than the traditional method of 2 ** 5. Going to treasure this nugget of knowledge forever.