Ad
  • Custom User Avatar

    Python

    There is indeed an issue in the reference solution

    With s = "lpll": 3 should equal 5
    With s = "lplll": 3 should equal 7
    With s = "llpplll": 6 should equal 8
    

    Not possible to create these palindrome length since they are longer than the original string.

  • Custom User Avatar

    With s = "lpllmdokuhqokgkmwyrfuzzcjgozlkqiqmhgdmvopiqkdlppqxjwyiyvhbchfvvsr": 3 should equal 5

    Can anyone help me to find 5?

  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    test.assert_equals(slogans("glorytoukraine","ukraineaineaine"),3)
    test.assert_equals(slogans("glorytoukraine","ukraineaineainee"),4)

    second test is "ukraine" + "e" + "e" + "e"?

  • Custom User Avatar

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

  • Custom User Avatar

    Edit: The other user edited their comment ~10 times after I replied, the original text was:

    It turns out that the fruits 'rottenrotten' and 'unroten' should be replaced by '' and 'un'?


    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:

    Keep kata focused on one task. Avoid distractions, do not add other, smaller, "side" requirements that do not add too much value to the task itself. Additional "steps" required to solve the task usually do not make the kata more interesting, but are rather seen as tedious and distracting. While things like validation of the input, parsing or stringification, filtering of invalid elements, etc. can be a part of some kata related to specific topics (for example, parsers or interpreters), usually they are just additional nuisance a user has to struggle with, and do not add too much value to the task.

    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.

  • Custom User Avatar

    It turns out that the fruits 'rottenrotten' and 'unroten' should be replaced by '' and 'un'?

  • Custom User Avatar

    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.

  • Custom User Avatar

    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'.

  • Custom User Avatar

    Imagine there's a planet with a fruit called 'rotten'. that would break your code.

  • Custom User Avatar

    it's can't pass ['rottenrotten', 'berotten']

    "The rotten fruit name will be in this camelcase (rottenFruit)"

  • Custom User Avatar

    это потому, что они забыли включить в тест Pig "latin" is cool...

  • Custom User Avatar

    The task could have been more difficult if the tests had included such an example:
    Pig "latin" is cool...

  • Custom User Avatar

    Because they passed all the tests

  • Loading more items...