Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Hi eldesanclemente! I think you can try the "divide and conquer" fib algorithm. The recursive version takes much time for long numbers.
try to use 'for' cycle. It works perfectly with Fibonacci and code is very easy to understand
same thing happening with me, won't seem to work
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?
Sorry, I should have mentioned that it was a random test. Anyway, I thank you for your attention and quick response.
The javascript control function was wrong, fixed. Remember mentioning the language when reporting a problem so we know where to look.
When you return
undefined
from the JavaScript function, you can see the expected outputs for the two (2) fixed tests (when you clickATTEMPT
) in the resulting error messages:After that, there are random tests.
I wrote the program in Javascript. I copied/pasted the result so that absolutely was a test.
There is no fixed test with that input in Python and the control function in the random tests returns
'87th'
for that input.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?
Passed all tests. Thank you Chrono79.
No problem, you can see what the input value is printing it: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#print-input
No, that's an example value, h is a parameter of your function, it's not a fixed value.
Yes.
Yes.
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.
@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...