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.
This comment is hidden because it contains spoiler information about the solution
Clean code, but a rather greedy approach in terms of resources, as you will have to process all the list and store all the numbers a second time to get to the result.
In Dart, the test expect the player function to have parameters that are dynamic lists instead of
List<int>
and thus will throw an error. Not a huge issue, but since the Katas are about writing good code, and good code has conservative type annotations, it "spoils" the Kata a bit.In Dart (or at least in the way I coded the solution) the floating point value of some numbers that the tests expect to be round (say
80
) is slightly shy of it (say79.999999999998
). When flooring as per instructions, the result becomes79
instead of the expected80
.Eventually I figured out what the problem was, and corrected it by simply adding
0.000001
to all my results before flooring them, however I think the test cases should be revised to eliminate this issue, as it adds nothing to the experience (it's not by chance that I found this Kata by picking the first hit when ranking for for "low satisfaction" at 7 kyu).Also in case somebody is interested: https://en.wikipedia.org/wiki/Potato_paradox
In Dart, the random test do not use immutable lists as input, as a result if the solution alters the original list, the test will fail.
In my case, since I was removing items from the list, the test expected the "correct" solution to be an empty list
[]
.I believe this is because the expected solution is computed after the actual one has ran.