Ad
  • Custom User Avatar
    • There is 1 word that starts with o -> {"o": ["only"]} -> 1 letter prefix, 1 word -> 1 = 1 -> OK
    • There are 2 words that start with a -> {"a": ["are","answers]} -> 1 letter prefix, 2 words -> 1 < 2 -> we will add more letters to make subdivisions
    • There is 1 word that starts with ar -> {"ar": ["are"]} -> 2 letters prefix, 1 word -> 2 > 1 -> Not OK
    • There is 1 word that starts with an -> {"an": ["answers"]} -> 2 letters prefix, 1 word -> 2 > 1 -> Not OK
    • There are 2 words that start with s -> {"s": ["some","solutions]} -> 1 letter prefix, 2 words -> 1 < 2 -> we will add more letters to make subdivisions
    • There are 2 words that start with so -> {"so": ["some","solutions]} -> 2 letter prefix, 2 words -> 2 = 2 -> OK
    • we take all the OK's in one final sorted array -> ["only", "solutions", "some"]
    • Mic drop!
  • Default User Avatar

    only -> beginning = o (1 letter, 1 word) OK \\\ Why 'o'? Its only one word here wtf??

    are -> beginning = ar (2 letters, 1 word) not OK \\\ Why 'ar'? Its only one word here wtf??

    answers -> beginning = an (2 letters, 1 word) not OK \\\ Why 'an'? Its only one word here wtf??

    Whats the logic here? Why dont author explain this in the description..

  • Custom User Avatar

    ONLY if their group size (or array length) is equal to the number of shared letters in each beginning

    • solutions, some -> beginning = so (2 letters, 2 words) OK
    • only -> beginning = o (1 letter, 1 word) OK
    • are -> beginning = ar (2 letters, 1 word) not OK
    • answers -> beginning = an (2 letters, 1 word) not OK
  • Default User Avatar

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

  • Custom User Avatar

    I'm getting the same with my JS solution. I'm guessing python random tests (or the reference solution) have some flaws (maybe that's why it's in beta). Luckily JS has no random tests :D

  • Custom User Avatar

    Yes, the description is explicit about that.

  • Custom User Avatar

    Fixed 0- 0-

  • Custom User Avatar

    In this kata you can't.
    Tests should take care of appropriate feedback on failure.

  • Custom User Avatar

    And I recommend you to use the spoiler flag, for this kind of things... 'x)

    cheers (note: I already marked your message)

  • Custom User Avatar

    There is no such test, the first sample test is this:

    test.assert_equals( score( [2, 3, 4, 6, 2] ), 0)
    

    Click reset, maybe you messed it up yourself.