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.
Took me a while looking through the Array docs to find
product
, I was trying hacky ways withpermutation
before that.This code is better than my own though!
Use
chars
instead ofsplit(//)
. It's several times faster and (IMO) more readablethat line is so long it hurts my eyes
This comment is hidden because it contains spoiler information about the solution
Thanks for your comments. I fixed the first two issues—thanks for catching them!
There are plenty of situations where having this in a separate class would be useful: you may want to initialize an instance once with an
unknown
parameter and then use that same instance a number of different times throughout your application, without having to specifyunknown
again.You could compare it to Redcarpet's API, e.g. (taken from its Readme):
What would you have done instead?
The method names in the description mismatch those in the skeleton code. Also, the method
#transcode_char
has a parameter in the skeleton code which is misleading / not required. Moreover, why does this transcoder need to be a seperate class?Clever solution. I wish I knew product method before.
This is not correct, as I had the exact same solution to start with. When given 100, this will return ",100".
Can we help to improve katas with better tests so errors like this (and I noticed a few) will not pass? And ... make sure that better test-suites are re-run against entered solutions?
This gets an upvote for best practice, but the solution is just plain wrong.
Damn it, submitted to early :D
remove output
Using it and works like a charm... What was it that frustrated you?
This comment is hidden because it contains spoiler information about the solution
If no initial value is given, this implementation does however change the originating array since '#shift' deletes the first value from the array.
So, handle with care ;)
Same here, either some tests or an more ellaborate description of the Kata would be helpful.
This comment is hidden because it contains spoiler information about the solution