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.
First solution (C) was a recursive one. Nice to look at, but too slow on higher values of n. Next one was iterative and much faster.
It was fun to work on this kata.
One of the rare case were I solved the Kata on my first attempt without any syntax error, logical error or a missing ";" :-)
Really nice one. We will do this with our trainees I think :-)
PHP testcases are broken:
One testcase "testShiftOf1" should shift the text "Hello World" by one.
Your case expects the result "IFMMP;XPSME". ALl characters are shifted by one execpt the " " that is shifted by 27 ' ' -> ';' (ASCII 32 to 59).
So it neither shifts the space by one nor leaves the space untouched.
EDIT:
OK, the fault is, that in the test-cases "actual" and "expected" are swaped.
I solved the Kata and could verify that the output of my function (wrong code) is shown as "expected" and the expected value is shown as "actual".
I think this causes all the Issue-Entries.
This is also a really nice one.
really good one. It was fun to solve this.
There should be more details about the constrains of this function in the description.
It took me a long time to find out in what cases (empty array, not an array etc.) the function should return true or false.
There might be an issue if the first array contains negative numbers. Most solutions (linke mine) just sort the array.
But
$a1 = [ 2, 4, -6 ]
$a2 = [ 16, 36, 4 ]
will be sorted into
$a1 = [ -6, 2, 4 ]
$a2 = [ 4, 16, 36]
and with this the most solution will fail