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.
This comment is hidden because it contains spoiler information about the solution
We cannot know what you're doing wrong without knowing your code, sorry.
"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.
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 turna
's, count from3
to4
. You could doaaabb
->abba
though, as2 <= 3
.I do agree that the description is quite lacking, but as this doesn't seem like a suggestion, I'm marking as resolved.
This comment is hidden because it contains spoiler information about the solution
Approved
Crystal: reference solution and author's solution are golfed beyond any reason and should be cleaned up.
This comment is hidden because it contains spoiler information about the solution
Read this again:
And see the second example in the kata's description.
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)
I agree to you. The description should be explain that point like clearly.
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. :)
amazing challenge... description was clear.. i don't know why people are complaining ..
In description it wasn’t mentioned that we can use letters only but exclude digits and others symbols or I’ve just missed it?
Ruby 3.0 should be enabled.
Loading more items...