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.
Opinions vary, but specs obviously aren't going to be changed after ten years. Closing.
A few suggestions, at least for the Clojure version:
Since you refer to the kind of input in the description as "stocklist", the name of the function we must define should be different, to show that the function transforms the "stocklist" from the description into something else.
As others have suggested, I think it doesn't make sense to return an empty vector when the "stocklist" is empty, but the "categories" input is not.
Why not use a map from strings to numbers for the "stocklist" input, instead of a vector of strings with implicit structure provided by spaces?
Why not use a vector of characters for the "categories" input, instead of a vector of strings, since the categories are defined by single capital letters anyway?
I think it would be better to leave the need to handle messy input data to our day-to-day jobs, and provide a cleaner interface in Kata so we can focus on solving the puzzle. I came up with an algorithmic solution to this Kata very quickly, but had to needlessly struggle with splitting strings, parsing strings as integers, matching strings to characters etc.
This comment is hidden because it contains spoiler information about the solution
Are you trying to use JavaScript like Haskell? :)
Please include stddef.h in C, so we don't have to.