Ad
  • Custom User Avatar

    The calculation is stated quite precisely: price per square inch, rounded upwards to the nearest cent. With such rounding, the cost comparison will result in more ties, and the final result will be based on diameter alone. I believe this is why your fork fails.

    (Different orders of operations might still lead to inconsistent answers, but this should be vanishingly unlikely, especially given the transcendental nature of pi.)

  • Custom User Avatar

    There're different ways to calculate the ratio for comparing price-per-squared-inch values (e.g. this) but they don't work here since regardless of the approach there will be inaccuracies from floating point computations which will mess up the order of the elements, and no rounding will be able to fix this. Either the description should provide an exact formula to be used or all the inputs should be integers to enforce using the solution linked earlier.

  • Default User Avatar

    The description is not clear at all, there's probably a trick to it but the 6kyu label doesn't warrant the time needed to complete.

  • Custom User Avatar

    Duplicate of all katas with problem statement as finding max with a key, (and the key is simple mathematical formula).

  • Custom User Avatar
    [
      {
        size: 'small',
        diameter: 7.973257075859718,
        price: 10.534023236496173,
        coupon: 1
      },
      {
        size: 'medium',
        diameter: 9.691686830733442,
        price: 15.463893092050782,
        coupon: 0
      },
      {
        size: 'large',
        diameter: 11.830106347736677,
        price: 20.921556537018805,
        coupon: 0
      }
    ]
    

    price property doesn't seem to be limited to two decimal places.

  • Custom User Avatar

    Role of coupons is not explained.

  • Custom User Avatar

    it seems to me you are contradicting your condition: "price and coupon will always be a number of no more than two decimal places (dollars)" in condition, and by example "price: 9.138753667456761" in random tests.