Ad
  • Custom User Avatar

    I went down the same rabbit hole and I can tell you that optimizing calculations won't help you here. You have to find a sublinear method based on the triangle's properties.

  • Custom User Avatar

    Thanks for authoring such a great challenge! After a few days of working on this kata, a fun mix of mathematical and programming insight finally got me a rather efficient solution!

  • Custom User Avatar

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

  • Custom User Avatar

    Barely passed -> Time: 11866ms Passed: 4 Failed: 0

    Kata was quite fun, had to add another condition in order to optimize it just under the 12000ms mark

  • Custom User Avatar

    darn, I thought I optimized it a lot but my code still times out, managed to solve 250 tests

  • Custom User Avatar

    Difference means: the result of subtracting one number from another. How much one number differs from another. From the title "Compare with Margin", the difference is going to be a positive number since you are comparing the the difference between the 2 numbers given and the margin. Say on the number line you have a point at -5 and another point at 6 and you are trying to see if the margin between the 2 numbers is less than 12. You would not say because -5 -6 = -11 and -11 is less than 12, you would get the absolute value of -5 - 6 and compare the two. It doesn't need to be explicitly written in the directions.

  • Default User Avatar

    Too late to change the requirements...

  • Custom User Avatar

    Super fun to solve! I struggled a lot on finding the method to get to the numbers, maybe you should make it to 2 decimal points because we are dealing with money after all?

  • Custom User Avatar

    I rounded mine to the nearest thousandth, this way it automatically goes to the nearest second if its close enough.