Ad
  • Default User Avatar

    Fighting for 0.2ms is micro-optimization

  • Custom User Avatar

    Micro optimization? For me, using his set approach doubled the execution time. In no way is changing that a micro optimization. With input row, where len(row)=725, it took 0.15ms with my current dictionary solution, using set approach instead, increased it to 0.32ms. Using your proposed alternative took no less than 0.20ms.

    Also, I think that your comment should have a spoiler flag.

  • Default User Avatar

    @realitant test output has been changed so that it's no longer vague or asking you to comb through large lists for some unspecified problem. The description typo with string/line for a single word has also been fixed.

  • Default User Avatar

    Rewrite to reference solution comparison here: https://www.codewars.com/kumite/664f538ca2b677fe163387ed?sel=664f538ca2b677fe163387ed

    note: contains description changes

  • Custom User Avatar

    If only one word fits on a line, it should be left-aligned and no trailing spaces have to be put after it.

    The description somewhat assumes that you already have a rough idea how justify alignment works. Maybe I should try to reread it provided no prior knowledge.

    Also the high number of issues comes from exceptionally bad assertion messages and the fact that the kata is old and was not fixed (and still is not in many languages) for 10 years.

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar
  • Default User Avatar

    python:

    I can use \r as delimiter between words instead of space and it passes. This is because tests uses str.split() without specifying delimiter, and then never checks for spaces.

    Similar to haskell, the general issue is that it checks for specific failures and passes if it doesn't find those. That doesn't mean it's correct. This is likely present in other languages as well, as it looks to be a translated pattern.

    Bonus issue: python test output is quite poor, in particular I noted the part about showing two lists and saying they're not equivalent, without stating where those lists are or what equivalent means - this is related to how it tests for specific issues as it therefore doesn't show actual/expected.

  • Default User Avatar

    haskell:

    https://www.codewars.com/kata/reviews/54f8b568a58bce1dde000e4a/groups/664e6faff17a79216ed71bac

    The general issue here is showing up in other languages as well, but I do not know whether they are wrong, what I know is that I do not like this test pattern one bit. And that general issue is that the tests consist of checking for specific ways the result might be wrong, but doesn't actually bother checking whether the result is right. I would much rather see a line-by-line comparison (or even the whole block at once), and not have any of these remarks. Yeah, I get that having no reference solution is sexy. It's also difficult/complicated/error-prone.

  • Default User Avatar

    So what you're saying in a really round-about way is that the word "Strings" should be replaced with "Lines"

    If that change gets made, one may as well also fix the rule above it:

    Last line should not contain '\n'

    which I really think ought to say "should not be terminated by '\n" (or be merged with the other line which already says the same thing, that they're separated, not terminated, but either way, they're not freaking contained, same as how a word does not contain space)

  • Default User Avatar

    No, they are not. The string "This Kata." is not one word, so the constraint you quoted does not apply. However, width = 5, they both need to go on their own line. Since lines cannot end in a space, the words will need to be right justified.

    Thank you for the clarification on line priority. Now fix the description to accurately reflect the requirement. Marking issues resolved without actually doing anything is probably the reason the Kata has dozens of "resolved" issues

  • Custom User Avatar

    In each line you should put as many words as possible. Only then you begin to fill and align the next line.

    Have you ever seen how justify works in your favourite word processor (e.g. MS Word or LibreOffice Writer)? There are no leading spaces.
    Lines with only one word fitting on it are covered by the rule

    Strings with one word do not need gaps ('somelongword\n')

  • Default User Avatar

    There's a space there in the input, which you can see by printing the input. Please check the input/output very carefully before creating an issue.

    The only issue I'm seeing is that the python version has poor test output. Guess it's gotta earn its 4kyu somehow.

  • Default User Avatar

    Test cases expect space to be added between punctuation even when the input string doesn't have it. No mention of that functionality is present in the description.

    Example ('orci.Fusce' as opposed to 'orci.','Fusce'):

    Result text not equivalent to original: ['Lorem', 'ipsum', 'dolor', 'sit', 'amet,', 'consectetur', 'adipiscing', 'elit.', 'Vestibulum', 'sagittis', 'dolor', 'mauris,', 'at', 'elementum', 'ligula', 'tempor', 'eget.', 'In', 'quis', 'rhoncus', 'nunc,', 'at', 'aliquet', 'orci.Fusce', 'at', 'dolorsit', 'amet', 'felis', 'suscipit', 'tristique.', 'Nam', 'a', 'imperdiet', 'tellus.', 'Nulla', 'eu', 'vestibulum', 'urna.', 'Vivamus', 'tincidunt', 'suscipit', 'enim,', 'nec', 'ultrices', 'nisi', 'volutpat', 'ac.', 'Maecenas', 'sit', 'amet', 'lacinia', 'arcu,', 'non', 'dictum', 'justo.', 'Donec', 'sedquam', 'vel', 'risus', 'faucibus', 'euismod.', 'Suspendisse', 'rhoncus', 'rhoncus', 'felis', 'at', 'fermentum.', 'Donec', 'lorem', 'magna,', 'ultricies', 'a', 'nuncsit', 'amet,', 'blandit', 'fringilla', 'nunc.', 'In', 'vestibulum', 'velitac', 'felis', 'rhoncus', 'pellentesque.', 'Mauris', 'at', 'tellus', 'enim.', 'Aliquam', 'eleifend', 'tempus', 'dapibus.', 'Pellentesque', 'commodo,', 'nisi', 'sit', 'amet', 'hendrerit', 'fringilla,', 'ante', 'odio', 'porta', 'lacus,', 'ut', 'elementum', 'justo', 'nulla', 'et', 'dolor.'] should equal ['Lorem', 'ipsum', 'dolor', 'sit', 'amet,', 'consectetur', 'adipiscing', 'elit.', 'Vestibulum', 'sagittis', 'dolor', 'mauris,', 'at', 'elementum', 'ligula', 'tempor', 'eget.', 'In', 'quis', 'rhoncus', 'nunc,', 'at', 'aliquet', 'orci.', 'Fusce', 'at', 'dolor', 'sit', 'amet', 'felis', 'suscipit', 'tristique.', 'Nam', 'a', 'imperdiet', 'tellus.', 'Nulla', 'eu', 'vestibulum', 'urna.', 'Vivamus', 'tincidunt', 'suscipit', 'enim,', 'nec', 'ultrices', 'nisi', 'volutpat', 'ac.', 'Maecenas', 'sit', 'amet', 'lacinia', 'arcu,', 'non', 'dictum', 'justo.', 'Donec', 'sed', 'quam', 'vel', 'risus', 'faucibus', 'euismod.', 'Suspendisse', 'rhoncus', 'rhoncus', 'felis', 'at', 'fermentum.', 'Donec', 'lorem', 'magna,', 'ultricies', 'a', 'nunc', 'sit', 'amet,', 'blandit', 'fringilla', 'nunc.', 'In', 'vestibulum', 'velit', 'ac', 'felis', 'rhoncus', 'pellentesque.', 'Mauris', 'at', 'tellus', 'enim.', 'Aliquam', 'eleifend', 'tempus', 'dapibus.', 'Pellentesque', 'commodo,', 'nisi', 'sit', 'amet', 'hendrerit', 'fringilla,', 'ante', 'odio', 'porta', 'lacus,', 'ut', 'elementum', 'justo', 'nulla', 'et', 'dolor.']

  • Loading more items...