Ad
  • Custom User Avatar

    Right. With that in mind the solution is smaller, and passes all test cases. Thanks for your patience!

  • Custom User Avatar

    Your task is to return the FIRST longest string consisting of k CONSECUTIVE strings taken in the array.

    You're missing the consecutive part. No faulty test.
    'ixoyx', '3452' and 'zzzzzzzzzzzz' are one after the other, 'wkppv', 'ixoyx', and 'zzzzzzzzzzzz' are not ('3452' is between the last 2).

  • Custom User Avatar

    OK, even when carefully keeping the order, there's a faulty test case:

    ['it', 'wkppv', 'ixoyx', '3452', 'zzzzzzzzzzzz'] 3
    'wkppvixoyxzzzzzzzzzzzz' should equal 'ixoyx3452zzzzzzzzzzzz'

    The 3 longest strings are (in order): 'wkppv', 'ixoyx', and 'zzzzzzzzzzzz',
    so the expected result should not be 'ixoyx3452zzzzzzzzzzzz'.

  • Custom User Avatar

    No, what he did was sorting the strings in descending length order, then returning 2 joined, what is wrong. But what you said maybe help him to clarify what to do in that case.

  • Custom User Avatar

    I experienced this too. You must have encountered something like this [boat, shoes, boat, shoe], where the expected is boatshoes yet your code returned shoesboat. I think it must return the first consecutive longest string, in this case boatshoes.

  • Custom User Avatar

    You're changing the order of the strings. The expected value is ok.

  • Custom User Avatar

    Some test cases are simply wrong. Eg.

    'owiaxujylentrklctozmymuwlwsasphmxx' should equal 'wlwsasphmxxowiaxujylentrklctozmymu'

    which should not.