Ad
  • Custom User Avatar

    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]?

  • Custom User Avatar

    It got marked as Best Practices, but here the idea is to solve it yourself instead of using libraries...

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Probably the best solution here in terms of algorithm. The one that got upvoted the most looks prettiest.

  • Custom User Avatar

    Blows my mind everytime I see a short solution like this.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.