Ad
  • Custom User Avatar

    Hi eldesanclemente! I think you can try the "divide and conquer" fib algorithm. The recursive version takes much time for long numbers.

  • Default User Avatar

    try to use 'for' cycle. It works perfectly with Fibonacci and code is very easy to understand

  • Default User Avatar

    same thing happening with me, won't seem to work

  • Default User Avatar

    I pass the three fixed tests (for n = 5, 7, 30) but fail when I try ATTEMPT.

    The issue is that my code takes too long (not efficient!). I'm guessing that the issue is
    the recursion that I use to find the Fibonacci sequence, but the Fib sequence is, by its very
    nature, recursive.

    So, my question is: does the program have to be non-recursive in order to pass all the tests?

  • Default User Avatar

    Sorry, I should have mentioned that it was a random test. Anyway, I thank you for your attention and quick response.

  • Custom User Avatar

    The javascript control function was wrong, fixed. Remember mentioning the language when reporting a problem so we know where to look.

  • Default User Avatar

    When you return undefined from the JavaScript function, you can see the expected outputs for the two (2) fixed tests (when you click ATTEMPT) in the resulting error messages:

    With input '1999' solution produced wrong output: expected undefined to equal '20th'
    With input '2011' solution produced wrong output: expected undefined to equal '21st'
    

    After that, there are random tests.

  • Default User Avatar

    I wrote the program in Javascript. I copied/pasted the result so that absolutely was a test.

  • Custom User Avatar

    There is no fixed test with that input in Python and the control function in the random tests returns '87th' for that input.

  • Default User Avatar

    I'm passing 101 out of 102 tests.

    The test I fail tells me that the year 8700 is in the 88th century: expected '87th' to equal '88th'

    That would be like saying that the year 2000 is in the 21st century (and we all know it is not).

    So, are the expected answers incorrect?

  • Default User Avatar

    Passed all tests. Thank you Chrono79.

  • Custom User Avatar
  • Custom User Avatar

    I interpret this to mean that the height of the window where mother is is fixed (i.e, always 1.5). Is this right?

    No, that's an example value, h is a parameter of your function, it's not a fixed value.

    Is window actually the height where the mother is? (which means that that height is not always 1.5, and, so, NOT fixed)

    Yes.

    I'm assuming the ball is dropped from h. Is this right?

    Yes.

  • Default User Avatar

    So how I understood it is. The h is anything greater than zero, window, where the mother is, value is changing and is greater than zero but less than h, and the ball is dropped from h.

  • Default User Avatar

    @Chrono79, Thanks you were right. It was because I wasn’t validating all the inputs. I do not know what test case was causing the infinite loop but once I validated all the inputs it fixed the issue. My guess was there was a situation where window was less than 0 and my h value never goes below zero so it created an infinite loop.

  • Loading more items...