Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    One of the rare case were I solved the Kata on my first attempt without any syntax error, logical error or a missing ";" :-)

  • Custom User Avatar

    Really nice one. We will do this with our trainees I think :-)

  • Custom User Avatar

    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.

  • Custom User Avatar
  • Custom User Avatar

    really good one. It was fun to solve this.

  • Custom User Avatar

    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