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
  • 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

    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