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.
Python
There is indeed an issue in the reference solution
Not possible to create these palindrome length since they are longer than the original string.
With s = "lpllmdokuhqokgkmwyrfuzzcjgozlkqiqmhgdmvopiqkdlppqxjwyiyvhbchfvvsr": 3 should equal 5
Can anyone help me to find 5?
ok
This comment is hidden because it contains spoiler information about the solution
test.assert_equals(slogans("glorytoukraine","ukraineaineaine"),3)
test.assert_equals(slogans("glorytoukraine","ukraineaineainee"),4)
second test is "ukraine" + "e" + "e" + "e"?
This comment is hidden because it contains spoiler information about the solution
Edit: The other user edited their comment ~10 times after I replied, the original text was:
Those aren't the names of fruit, so the question is malformed. There are plenty of real-life scenarios where we know a lot about our data and do not need to exhaustively validate it.
From the Codewars Kata Authoring Guidelines:
If I were being pedantic I would point out that neither of your adversarial examples are actual failure cases, even with the additional requirements you assume - both are out of specification, with the first in the wrong casing and the second misspelled. I don't disagree that there's some ambiguity here but I do not think adding boring additional validation requirements is the way forward - the spirit of the kata can be maintained with a slightly more robust description.
It turns out that the fruits 'rottenrotten' and 'unroten' should be replaced by '' and 'un'?
The need for input validation and edge-case handling is domain-specific; it's common when dealing with strings especially, but it is not universal. If our domain knowledge allows us to assume things such as "all fresh fruit names are singular lower-case words which do not contain 'rotten'" and "all rotten fruit names are the word 'rotten' followed by a fresh fruit name, in camelCase" then we do not need to handle the edge cases you suggest. The description could perhaps be more clear, but it does seem to allow that assumption.
Adding random input validation requirements is not recommended on CodeWars, so I don't think this is a good suggestion.
Imagine there's a planet with a fruit called 'rotten', 'unrotten', 'rottenbanana' or 'rottenrotten'
Most of the solutions presented will not pass such a test, because the test does not contain examples with 'rotten' without camelcase or containing 'rotten' but not starting with 'rotten'.
Imagine there's a planet with a fruit called 'rotten'. that would break your code.
it's can't pass ['rottenrotten', 'berotten']
"The rotten fruit name will be in this camelcase (rottenFruit)"
это потому, что они забыли включить в тест Pig "latin" is cool...
The task could have been more difficult if the tests had included such an example:
Pig "latin" is cool...
Because they passed all the tests
Loading more items...