Ad
  • Custom User Avatar

    Sorry, I noticed I had sorted the array before printing final result.
    However, I still hope for the instruction to be clearer for people like me, who thought of sorting array based on its length or alphabet order, which would still be applied for the "abigailtheta" example.
    I had also spent a long time fixing error because I thought for multiply cases with the same length, the choosen element would be in alphabet order.

    Edit: I have to expand this question with another issue:

    Failed asserting that two strings are equal.
    Expected: 'ixoyx3452zzzzzzzzzzzz'
    Actual  : ' index 0 with value it index 1 with value wkppv index 2 with value ixoyx index 3 with value 3452 index 4 with value zzzzzzzzzzzz and 3'
    

    This time, I did print out the first $strarr. My assumption is the test array would be $strarr = ['it', 'wkppv', 'ixoyx', '3452', 'zzzzzzzzzzzz'].
    Why wouldn't 'wkppv' be chosen, even though it had the same length as 'ixoyx', stayed first in index order and was longer than '3452'?

    Edit2: Okay, problem fixed. I realize the problem was not the code, but me being a dum-dum who couldn't understand english word. Sorry.

  • Custom User Avatar

    Working with PHP 7 here.
    After multiple failure, I had tried to see exactly which array was being tested, and here is the result:

    Failed asserting that two strings are equal.
    Expected: 'wlwsasphmxxowiaxujylentrklctozmymu'
    Actual  : ' index 0 with value owiaxujylentrklctozmymu index 1 with value wlwsasphmxx index 2 with value wpgozvxxiu and 2'
    

    So apparently the tested array is $strarr = ['owiaxujylentrklctozmymu', 'wlwsasphmxx', 'wpgozvxxiu'] and $k = 2.

    You would think the result would be "owiaxujylentrklctozmymuwlwsasphmxx", but no, it's "wlwsasphmxxowiaxujylentrklctozmymu".
    Be it an index order or alphabet order, that's plainly wrong. By the way, this is in the basic test.

  • Custom User Avatar

    I don't think without "return" you can send any output with this method.

  • Custom User Avatar

    To any future PHP fella who got the "Execution Timed Out" error: It's not because of the server, or the question. Think of all possibilities and try your best (even if it took you 2 hours just staring at the code and wondering why you didn't just spam "unlock solutions" button already)

  • Custom User Avatar

    I have no idea the test in testBasics is different from sample test, thus the misunderstanding. Thanks for the clarification.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The test case in PHP 7 told me that my code failed in both test. While I couldn't check testRandom case, testBasics gave me "Failed asserting that 15 matches expected 21." even though the sample test wrote "$this->revTest(bouncingBall(30.0, 0.66, 1.5), 15);". I'm confident my logic isn't wrong, so I wonder where the "21" result in the test is.