Ad
  • Custom User Avatar

    classic off by one error... you need to say pop < p not pop <= p and you must floor each iteration

  • Custom User Avatar

    Not nearly as elegant, however

  • Custom User Avatar

    I am getting the same. Expected 50, Got: 51
    Any clues on this? Is this a faulty test case. I am using Java.

    Update -- Solved, it was my wrong.

  • Custom User Avatar

    Are you the only one who goes againt the result of 6156 guys? I can only repeat what I said: your method is wrong.
    I agree with 2 + 2 = 4 because the calculation is correct but that doesn't mean that it is a good result for a test of the kata.
    I don't want to be rude (and if you think that I am, I will be very sorry).
    If you want you could unlock the JS solution and look at right solutions.
    Cheers!

  • Custom User Avatar

    I have made the solution which pass all tests except this one, because this one is incorrect!
    If you agree with my calculation, how can you deny that the test is invalid?
    Link above proves that 150 is correct answer for given set of input data (1500000, 0.25, -1000, 2000000), isn't it?
    p.s. We can discuss this in private messages if you are worried about spoilers :)

  • Custom User Avatar

    Yes your calculation is certainly correct but it is not the good way to get the result... I can't give the solution:-)

  • Custom User Avatar

    I'm sorry, but can you explan me the fact, that even wolframalpha considers just as I, just check it:
    https://www.wolframalpha.com/input/?i=((1.0025)%5E150)*1500000+%2B+(-1000*150)
    The result is stiil greather than 2000000 :)

  • Custom User Avatar

    I am very sorry, look at the top of the page: 1754 guys passed the JS kata, 6145 with all languages. The tests are the same in all the 13 languages. For all these reasons there can't be any error in the tests. Don't forget that decimal part of a population don't have babies:-)

  • Custom User Avatar

    One of basis tests:
    Test.assertEquals(nbYear(1500000, 0.25, -1000, 2000000), 151);
    But it should be:
    Test.assertEquals(nbYear(1500000, 0.25, -1000, 2000000), 150);
    just check out this js expression:

    1500000*Math.pow(1.0025, 150) + (-1000*150) > 2000000; // => true
    
  • Custom User Avatar

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

  • Custom User Avatar

    Passed 105, Failed 1.
    Expected: 50, instead got: 51

    Can anyone please shred some light here.

  • Custom User Avatar

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