5 kyu

Finding the Closest Maximum Values of a Function to an Upper Limit

84 of 210raulbc777
Description
Loading description...
Fundamentals
Mathematics
  • Please sign in or sign up to leave a comment.
  • ahmet_popaj Avatar

    Simple and nice kata to practice some little math with, congratulations.

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • dfhwze Avatar

    How can we get to 1000 in this test case using only integers?

    range1 = [1, 50]
    range2 = [1, 50]
    hMax = 1000
    k = 5
    test.assert_equals(max_val_f(range1, range2, hMax, k), [784.0, 841.0, 900.0, 961.0, 1000.0])
    
  • JohanWiltink Avatar

    ( Haskell, possibly others )

    The function should output the largest values of f(x, y) less or equal than hMax ..

    That would be ".. the largest unique values .." ( or maybe "different" ).

  • Echsenkoenig Avatar

    I'm trying to solve this Kata in C#. I implemented a solution, which passes the sample tests, but fails the RandomTests. I get values for hMax, which are way bigger than the highest values, I get. And my values seem to go higher, than the expected solutions. Here is an example:

    range1: 3 : 12 range2: 2 : 11 hMax: 7409283 k: 5

    Expected string length 25 but was 28. Strings differ at index 1. Expected: "[243, 256, 343, 625, 729]" But was: "[625, 729, 1024, 1296, 2187]" ------------^

    It seems, that hMax, which I receive, is much higher, than the one with which the test case computes its expected results. Could you check this?

  • Voile Avatar

    Approved

  • PaulCalvelage Avatar

    I suggest changing "smaller than" to "not exceeding" here:

    The function should output the largest values of f(x, y) smaller than hMax

    This would make it more clear that hMax is allowed. It should have the meaning of "less than or equal to" or "not greater than".

  • PaulCalvelage Avatar

    Spelling error in the description: "bellow" should be "below" in the description of parameter #3.

  • PaulCalvelage Avatar

    The graph and its caption in the description use zmax and zMax. However, the definition of f, most of the description, and the solution/test template use h and hMax for the third variable.

  • ecolban Avatar

    For range1 and range2, the description states that the boundaries are inclusive. However, for the first test in the"Your Tests" section, I need to exclude the upper boundaries to pass the test. However, when I submit, I need to include the upper boundary to pass. For the second test, I get values that are higher. For example, for x = 18, y = 20, f(x, y) = 361, but this value is not included among the values in the expected result.