Ad
  • Custom User Avatar

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

  • Custom User Avatar

    We cannot know what you're doing wrong without knowing your code, sorry.

  • Default User Avatar

    "For this Kata you need to write a function that takes a string of characters and returns the length, as an integer value, of longest alphanumeric palindrome that could be made by rearranging the characters."

    I think this more clearly and concisely explains the goal.

  • Custom User Avatar

    The emphasized part is saying that the final palindrome should never have a letter appearing more in it than in the original string.

    So you can't do aaabb -> aabbaa, because that would turn a's, count from 3 to 4. You could do aaabb -> abba though, as 2 <= 3.

    I do agree that the description is quite lacking, but as this doesn't seem like a suggestion, I'm marking as resolved.

  • Default User Avatar

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

  • Custom User Avatar

    Approved

  • Custom User Avatar

    Crystal: reference solution and author's solution are golfed beyond any reason and should be cleaned up.

  • Default User Avatar

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

  • Custom User Avatar

    Read this again:

    longest alphanumeric palindrome that could be made by combining the characters in any order but using each character only once.

    And see the second example in the kata's description.

  • Default User Avatar

    FORMAL REQUEST FOR BETTER EXPLANATION OF CHALLENGE

    Can the author of this challenge please look to:

    (a)
    Provide a far better explanation of this challenge than is currently being given

    (b)
    Provide a clear definition and/or clarification of what an 'alphanumeric' character is

    and

    (c)
    Review the accuracy of all of the tests that have been built into this challenge


    SCRUTINISATION OF EXAMPLE TEST

    For the test "$aaabbbccddd_!jJpqlQx_.///yYabababhii_"

    If the 'alphanumeric' characters are "abcdefghijklmnopqrstuvwxyz0123456789" (i.e - the lower case letters 'a-z' and numbers '0-9')

    then

    The original text of "$aaabbbccddd_!jJpqlQx_.///yYabababhii_" gets reduced to "aaabbbccdddjjpqlqxyyabababhii"

    If the answer is 25 then there are five possible excerpts that could constitute the answer to the test

    Possibility A - Indices 0-24 - aaabbbccdddjjpqlqxyyababa

    Possibility B - Indices 1-25 - aabbbccdddjjpqlqxyyababab

    Possibility C - Indices 2-26 - abbbccdddjjpqlqxyyabababh

    Possibility D - Indices 3-27 - bbbccdddjjpqlqxyyabababhi

    Possibility E - Indicies 4-28 - bbccdddjjpqlqxyyabababhii

    For it to be possible for there to be a palindrome, there can be no more than one instance of a letter which appears an odd number of times

    Using only the letters 'a-h' I can demonstrate that none of the above five possibilites can be correct, and hence that the answer to the test of "$aaabbbccddd_!jJpqlQx_.///yYabababhii_" cannot be 25


    Possibility A - Indices 0-24 - aaabbbccdddjjpqlqxyyababa

    a = 6 times (even)

    b = 5 times (odd)

    c = 2 times (even)

    d = 3 times (odd)


    Possibility B - Indices 1-25 - aabbbccdddjjpqlqxyyababab

    a = 5 times (odd)

    b = 6 times (even)

    c = 2 times (even)

    d = 3 times (odd)


    Possibility C - Indices 2-26 - abbbccdddjjpqlqxyyabababh

    a = 4 times (even)

    b = 6 times (even)

    c = 2 times (even)

    d = 3 times (odd)

    h = 1 time (odd)


    Possibility D - Indices 3-27 - bbbccdddjjpqlqxyyabababhi

    a = 3 times (odd)

    b = 6 times (odd)

    c = 2 times (even)

    d = 3 times (odd)

    h = 1 time (odd)


    Possibility E - Indicies 4-28 - bbccdddjjpqlqxyyabababhii

    a = 3 times (odd)

    b = 5 times (odd)

    c = 2 times (even)

    d = 3 times (odd)

    h = 1 time (odd)


    On the above detailed and logical reasoning, the answer to the test "$aaabbbccddd_!jJpqlQx_.///yYabababhii_" cannot be 25 (twenty five)

  • Custom User Avatar

    I agree to you. The description should be explain that point like clearly.

  • Custom User Avatar

    Once you realize what you need to do, yes, it is quite clear. The discussion helped me realize, to be honest. It is rather easy to be misinterpreted though. This kata is more about jumping to conclusions than the actual exercise itself. :)

  • Default User Avatar

    amazing challenge... description was clear.. i don't know why people are complaining ..

  • Default User Avatar

    In description it wasn’t mentioned that we can use letters only but exclude digits and others symbols or I’ve just missed it?

  • Custom User Avatar

    Ruby 3.0 should be enabled.

  • Loading more items...