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.
Like the others have said before, is the solution good mathematical work. But in programming bad practice. For small n you can use it, but for greater n it would screem for a stack overflow.
The reason is that you call in each return the function nthfib for two times, which will be saved in the memory till you reach 1. At this point it bubbles back and return the addition from the retun statements.
This mess up the memory and crash your system.
An other solution, like mine, is the linear one where you loop up. With the use of one temporary int I can calculate the n-th fibonacci. The memory it´s also constant, in the inner loop you use constantly three int with each 4 Byte = 12 Byte. This isn´t much.
This is a clever solution
wow this is much simpler
well that make sence.............
Why am I so stupiddddd
не ну круто!
Oh I definitely should have thought of this! Very clever.
I like it!
great!
best
Awesome, I was wondering how to do it in one line.. here's how xD
Great way to simplify the logic down to just what's needed
This comment is hidden because it contains spoiler information about the solution
Clever
Wish I would have thought of this. Great logic.
Loading more items...