Beta

The strictly necessary number of words for reading your numbers outloud

Description
Loading description...
Mathematics
Performance
  • Please sign in or sign up to leave a comment.
  • Mednoob Avatar
    1. 100_000 random tests are still not OK. Performance testing should be bigger input, not more tests. I also don't understand why this is tagged Performance in the first place. Is there even any other implementation that would time out?
    2. Random tests should be split into some categories of inputs, starting from the small ones to big ones.
  • monadius Avatar

    The reference solution is incorrect. Here is an example: base = 7, max = base ** 3 - 1 = 342. The reference solution returns 10. But the correct answer is 7 + 2 = 9 since max < base ** 3.

  • Mednoob Avatar
    1. Use assert.strictEqual instead of assert.equal
    2. Why are there no tests that checks max < base? I think this case should be valid.
    • Mednoob Avatar
      1. Why are there 1 million random tests?
    • mauro-1 Avatar

      Why are there no tests that checks max < base?

      There are tests where max < base, but with the wrong result, e.g.:

      assert.equal(words(10, 4), 10);
      

      The number of words needed to read numbers up to 4 is 5 (including 0) or 4 (excluding 0), not 10.

      Same bug in random tests.

    • carafelix Avatar

      Oh, I thought that even if the max < base you would still have words for the leftovers of the system from a proper understading of the system itself. But you both are right. In the way I defined the problem before it makes more sense your way

    • carafelix Avatar

      Description changed. I think it's more proper to still have the minimum amount of words needed for any max to be base.

      Issue marked resolved by carafelix 4 months ago