Ad
  • Custom User Avatar

    That dogma is barely true in toy problem exercises, and complete nonsense in actual industry work.

    Lengthy comments, which might not get updated when circumstances change, can be a negative thing. Clear and concise comments, which explain the reasoning behind a step that might not be immediately obvious, are always professional and will be appreciated. Either by a colleague, or by yourself when you're trying to recall your own thinking 6 months later!

  • Custom User Avatar
  • Default User Avatar

    Hi, thanks for reporting. I've changed the description an the test cases. There were multiple issues:

    1. Bug in the reference solution => the test suite didn't catch the bug.
    2. Words ending with -i an -u are exceptions. The correct instrumental form of szaru is szaruval and for Peti is Petivel. I added this case to exceptions and excluded them from the test cases.

    Regards,

    suic

  • Custom User Avatar

    This is single most confusing Kata I've ever gone through on this site.

    The instructions indicate that for words ending with a vowel, your code should:

    1. Replace a "short" vowel with a "long" one (presumably you leave it as-is if already "long"?).
    2. Then append a "vel" or "val" suffix, depending on whether the ending vowel is "front" or "back" (presumably the ending vowel AFTER step #1, rather than the original one?).

    No spoilers about my code, but the tests fail on the word "szaru".

    • My code converts this to "szarúval" (short replaced with long, and "val" appendend for back vowel).
    • But the test is expecting "szaruval" (short left as-is???).

    Could this be a bug in the test suite implementation for Groovy? Or am I just really missing something in these vague requirements? I'm producing what appears to be the correct value, but the tests fail regardless.

  • Custom User Avatar

    Some people like the math. It is, afterall, tagged math.

  • Default User Avatar

    substring is valid up to and including the length of the string. It would not throw on error on substring(1). In fact, it would still behave fine (empty string + 1 char).

    From the String doc: Throws: IndexOutOfBoundsException - if beginIndex is negative or larger than the length of this String object.

  • Custom User Avatar

    Oh good grief.

    I started out with a query identical to the top-rated solution, but couldn't get it to work right. I assumed that the root problem was the result set's department column having the same name as the actual department table.

    It turns out that that I simply had a typo, and was joining department.id to sales.id, rather than to sales.department_id.

    So frustrating. I hope that no one sees my solution here and thinks I was doing something "clever"!

  • Custom User Avatar

    I don't know, calling this one even "7 kyu" might be a bit too generous. It's taken straight from the "CREATE FUCTION" page in the PostgreSQL documention, with the solution being the second example verbatim!

  • Custom User Avatar

    This sort of "5 kyu" kata are the worst. :(

    Really, "8 kyu" for the trivial programming... and "3 kyu" for the arcane math concepts if you're a few years out of school.

    The best challenges are the inverse.

  • Custom User Avatar

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

  • Custom User Avatar

    To satisfy the original function definition, you could just append as u32 to this one-liner. I did something similar, but only because this is such contrived toy problem. You'd never want to do that in the real world, because usize can vary across platforms and therefore assuming that it can always be cast as u32 would be very brittle.

    Unnamed is right, this might as well be considered a typo by the kata author. However, I too am surprised that the system allowed him to get away with just changing the function definition.

  • Custom User Avatar

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

  • Custom User Avatar

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