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.
Kata description is "Given an array with exactly 5 strings". And there is no specifications / requirements how the method should work if the argument array contains different number of strings.
Based on the older comments on the discussion chain, it sounds like the test cases didn't originally match with the kata description (i.e. the random tests could test the solution with parameter value 0).
Thanks for the comment: this is quite valid point to consider (which I very likely didn't consider when writing that solution). If I would be nitpicking, I could argue that the requirements can be interpreted so that the rules for a smiley face can be applied for substrings as well instead of the whole string in the array - and with this interpretation, 2 would be the expected result ;)
yep, you are right. It doesn't fulfill the last requirement (which would then be missing from the tests as well then)
This question isn't really related to preg_match_all function but rather to using regular expressions in general in php. But sure, these characters mean:
the '/' characters are delimiters that enclose the pattern (http://php.net/manual/en/regexp.reference.delimiters.php)
the '?' is used here to denote that the matched character ('-' or '~') can appear 0 or 1 time (http://php.net/manual/en/regexp.reference.meta.php)
mmm, thanks for the pointer - will be checking those out. Was already thinking about the potential next steps (including the generic problem) but didn't yet have time to check whether something like that already existed :)
Great kata - best one I've stumbled across by a large margin. Required studing some new concepts and working old school penning fsm and working with the transformations. Took me longer to get it right than I care to admit, but at least I can easily say that I learned some new stuff here. Just wanted to say thanks for this & keep up the good work.
thanks. Yep, thought of that but just resulted in writing it in this more compact format (without that one extra line). In general, this solution is in any case more about using array functions in compact form - I wouldn't write this kind of code in real projects ever (instead I would write down the function in longer form that would result in code that is easier to read/understand by everyone).
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Could you update the data description a bit?
it currently has the following row:
'ABC' --> x=65, y=66, z=67 --> '656667'
whereas this should probably be:
'ABC' --> A=65, B=66, C=67 --> '656667'
Anyone got an answer for this? Couldn't find any easy way of locating my own upvoted solutions either...
Could you please update the test cases (php at least) so that it includes a case with integer strings (or alternatively change your kata description so that it speaks only about the float values)? Currently your test set accepts solutions that simply use floatval for the conversion, meaning that for parameter array ["1", "2", "3"] returning array [1.0, 2.0, 3.0] passes the tests (which is contradictory to the example in the kata description).
It probably means that your solution doesn't work with integer string values as described in the problem description. Your solution returns [1.0, 2.0, 3.0] for parameter array ["1", "2", "3"] whereas it should return [1, 2, 3]. The test set seems to be a bit lacking as they are not testing this case.
This comment is hidden because it contains spoiler information about the solution
Loading more items...