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.
Why are the results so truncated? I can't debug my code with something like:
With k = 1, arr = 47,81,43,130,32,107,311: expected 'Rearrangement: 107, 130, 311, 32, 43,…' to equal 'Rearrangement: 107, 130, 311, 32, 43,…'
Cool kata! First tried the brute force approach and timed out. Then realized this is a puzzle and not a plotting exercise. Gave it some thought away from the computer and came up with a solution.
Fun to solve. Thanks. Good graphics in the description - very helpful.
I'd suggest adding a test case for when the mean is equal to one of the found numbers. I was passing the random tests most of the time until this scenario occured.
I made changes based on your comments. Does it look any better?
I tried to paste my solution into the index.js file on the linked website but it seems to be read only. I even logged in but no dice.
In the description under Examples you show the output for sample test 4 being { A: 114, B: 90, C: 106, D: 116 }. That is the output I get but the test yeilds this result:
expected { A: 114, B: 90, C: 106, D: 116 } to deeply equal { A: 118, B: 94, C: 110, D: 120 }