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.
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:
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.
Working with PHP 7 here.
After multiple failure, I had tried to see exactly which array was being tested, and here is the result:
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.
I don't think without "return" you can send any output with this method.
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)
I have no idea the test in testBasics is different from sample test, thus the misunderstanding. Thanks for the clarification.
This comment is hidden because it contains spoiler information about the solution
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.