Ad
  • Custom User Avatar

    thanks a lot!
    it would be great to have typed functions to make much easier to understand the conditions of the kata.

    I would be happy to updated them if that's possible.

  • Default User Avatar

    Although not explicitly stated, the sample tests indicate that the price isn't always an integer, so your calculation might be wrong, and also you type hint the input (see what happened when in not strict mode?).

    Closing as this is not an issue with the tests.

  • Custom User Avatar

    Am I making something wrong? or the random test for PHP is faulty?

    it says for example, that with a bonus of 703 and a price of 1,I should only be able to make 11 floors,
    when 12 full floors would require 650 cans

    or with a bonus: 739 and price: 5 (147 buyable beers) it can only make 6 floors, when 7 requires 140 cans

    or with a bonus: 720 and price: 5 (144 buyable beers) it can only make 6 floors, when 7 requires 140 cans

    or with a bonus: 876 and price: 2 (438 buyable beers) it can only make 9 floors, when 10 requires 385 cans

  • Custom User Avatar

    I understood why the truth was expected: -14*-14 = 196

    But my solution was to first find the root of the number Math.sqrt(196); then find it in array A

    Maybe I'm not the only one who solved the task in reverse order๐Ÿ˜Š๐Ÿ˜Š

  • Custom User Avatar

    Test8: not sure if this is the right test

    log
    [0, -14, 191, 161, 19, 144, 195, 1]
    [1, 0, 196, 36481, 25921, 361, 20736, 38025]
    expected: true but was: false

    why expected true?

  • Custom User Avatar

    oh my I totally missed it, thanks!

  • Custom User Avatar

    That's not the test you're failing. You have a flawed first if condition, and return an incorrect value, so you don't even print the array of actual failing test. Try moving your if condition after print_r.

    Make sure to read the last line of description carefully. null isn't the same as empty array.

    The issue is in your code, not the kata itself.

  • Custom User Avatar

    Seems like the test cases for PHP are faulty:

    I'm getting and error with the following test case:

    array 1

    Array
    (
        [0] => 121
        [1] => 144
        [2] => 19
        [3] => 161
        [4] => 19
        [5] => 144
        [6] => 19
        [7] => 11
    )
    

    squared and counted array 1

    Array
    (
        [14641] => 1
        [20736] => 2
        [361] => 3
        [25921] => 1
        [121] => 1
    )
    

    array 2

    Array
    (
        [0] => 121
        [1] => 14641
        [2] => 20736
        [3] => 36100
        [4] => 25921
        [5] => 361
        [6] => 20736
        [7] => 361
    )
    

    squared and counted array 2

    Array
    (
        [121] => 1
        [14641] => 1
        [20736] => 2
        [36100] => 1
        [25921] => 1
        [361] => 2
    )
    

    invalid

    Failed asserting that false is identical to true.