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.
It really depends on your logic. Not all ways of doing this add both divisors to the array. i.e. when getting factors of 72 and you are testing 2, not all algorithms will also add 36 in the same iteration. If you take a functional approach such as filtering a range of 2..x, x needs to be the initial input divided by 2. If you are looping and adding both divisors, then square root works fine.
This comment is hidden because it contains spoiler information about the solution
FYI - You can split using a regex rather than doing a replace + split.
Instructions and tests didn't specify, but I assumed we couldn't use the first word unchanged. What happens with this test:
Why wouldn't the return value for:
removNb(26) should return [ {15, 21}, {21, 15} ]
simply be[ {15, 21} ]
? Mathematically speaking the set of {15, 21} is the same as the set of {21, 15}.I think this Kata needs a test where
m == n
. Such astesting(37, 37, 37, [["M: 37", "B: 5", "C: 4"]])
. I only mention this because the top solution in Elixir is currently wrong for this test.I don't think you need the
def howmuch(n, n), do: []
part. I usedStream.filter_map
and the case form == n
works. It may look like an optimization, but actually it is wrong. Try adding a testtesting(37, 37, 37, [["M: 37", "B: 5", "C: 4"]])
. I think the author should add such a test.Draw a picture and add stuff up by hand. It's much easier then.