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.
Time complexity O(2^n), very bad solution.
Omg... I was inconsiderate 🤦
You are absolutely right)
Now everything works as expected.
Thaks!
Hi @krbtsv - I'm not sure I understand your question; the above code produces:
[1, 1, 1, 3, 5, 9, 17, 31, 57, 105]
for input
tribonacci([1, 1, 1], 10)
.Maybe you have 2 different functions with the same name in your IDE while debugging or something like that?
It's doesn't work. Why? Can someone explain me this?
print(tribonacci([1, 1, 1], 10)) it returns: [1, 1, 1, 3, 3, 5, 7, 11, 15, 23, 33]
When the correct answer is [1, 1, 1, 3, 5, 9, 17, 31, 57, 105]
I checked the solution several times and logically everything should normal. But...
Is this the magic of recursion?
Nice one liner but it takes twice the amount of time to process than the top voted ones.
Amazing
Nice!
Be sure to only recurse until the number of items in signature become greater than n.
it seems like if someone explained why the code terminates, a comment three years from now would be asking why the code doesn't terminate, and this would just go on forever...
Can you explain me why and how does the recursion terminate ? I'm new to coding