Ad
  • Custom User Avatar

    nice and cleas solution.
    IMHO, it would've been perfect without named return

  • Default User Avatar

    aha, that's where it was - thanks a lot for pointing out

  • Default User Avatar

    It would be good to have a test where there are two words with the same raking.
    For example I have adjusted one of the existing inputs to the following "what time are we climbing up the volcamp volcano"

    If I understood the requirements correctly, then "volcamp" and "volcano" would have the same ranking
    and thus "volcamp" should be selected, because it comes first in the input.

    I believe that current top voted solution would fail above test.

  • Default User Avatar

    a very neat solution indeed.
    I am trying to figure out whether the following requirement is met: "If two words score the same, return the word that appears earliest in the original string."

    In order to check it, I have modified one of the existing tests to have the following input: "what time are we climbing up the volcamp volcano"
    If I understood the requirements correctly, then "volcamp" and "volcano" should have the same ratings and thus "volcamp" should be selected
    because it comes first in the input.

    I think current implementation would still select "volcano" though?