Ad
  • Custom User Avatar

    A very satisfying Kata to have solved in the end, but it definitely has a "real world" feel. In the sense that the main difficulty is in, first, understanding and often guessing the requirements, and, second, debugging when you passed all specific tests but hundreds of random tests still fail and you have no guide...

    In the end, after some incremental progress in debugging I decided to entirely scrap my bounding system for a simpler one easier to debug and all was solved.

  • Custom User Avatar

    Got basically the same thing. It's good to know heapq but for a simple logical task it's nice to be able to do it with no library, though I admit I was cringing a bit at my own till[till.index(min(till))], an obviously redundant and costly operation.

  • Custom User Avatar

    I'm a little torn on this one. Inputs are at 2DP, and there are two possible interpretations of that:

    1. Inputs are exact 2DP numbers, and are therefore perfectly precise
    2. Inputs are inexact and rounded to 2DP, and are therefore precise to +-0.005 units

    In the first interpretation, your solution is incorrect if it disagrees with the test results. You can verify this by being as precise as possible with your calculations, using rational numbers only in a fractional representation (therefore perfect precision) for all intermediate calculations, and introducing pi (irrational) only directly before rounding and returning your result. If you do this you'll see that none of the tests fail, and therefore other failures using floating point must be due to unnecessary error propagation - technically speaking that's a bug in your code and not a kata issue.

    In the second interpretation, however, it's the tests that are wrong to expect 5DP precision. You cannot take two inexact values and produce an output that is more precise.

    Given the kata is 7-kyu I lean toward the second option; tests should be rounded to at most the precision of the inputs. Correctly solving the first interpretation requires some knowledge of numerical analysis and error propagation which exceeds the intended difficulty of the kata, even though with a bit of fiddling most people would get it "correct" eventually. Adding this as a suggestion to the kata.

  • Custom User Avatar

    Yup, went the same way for me. I was off by a tiny bit and had to play around to find the "right" order

  • Custom User Avatar

    Test cases marked as True or as False by a few decimals points, depending on whether some multiplication is put first or last. That is a serious bug. Test should not exactly compare floats !