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.
Passes the tests but doesn't solve the problem posed.
need a third button -->
Successful Hack
Javascript
in what language?
Fair call, you're right. Perhaps the tests should be updated for this particular case.
Nice idea, but it doesn't quite work.
Yes, anagrams must have equal sums, but equal sums are not necessarily anagrams.
This passed the example tests because they were inadequate to reveal the error. The following test would fail using your code:
Test.assert_equals(anagrams('add', ['ace', 'dad', 'ebb', 'fab', 'gaa']), ['dad'])
Also, please raise this as a
question
instead of anissue
:)This comment is hidden because it contains spoiler information about the solution
You're not returning the result, so whoever using your function would not get your result properly.
It looks like the tests are broken.
Very cool idea! Thanks.
However, I have a couple of comments:
10, 11, 12, ... 20
with (Binomial) proportions
1 : 10, : 45 : 120 : 210 : 252 : 210 : 120 : 45 : 10 : 1
therefore (%3 + 1) values 1, 2, 3 occur with proportions
1+120+210+10 : 10+210+120+1 : 45+252+45
i.e.
341 : 341 : 342
The deviation from uniformity is small, and gets smaller with larger array size.