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.
WTF? How does that even work?
Gz on the clean solution, btw
Thank you!
So it is an inline conditional... here is an article explaining it better than I could.. :)
https://www.natashatherobot.com/ruby-shorthands-if-then-else/
I'm a total noob at this. Would someone please tell me how this works? I've tried googling colon and questionmark, but I haven't found a satisfactory explanation.
Not
A-z
but[A-Za-z]
or[a-z]/i
I have no idea with recursion solution :) But your & my code working fine with big n :)
You are absolutely right, sir.
First time ever I see that recursion is actually not a clever thing to do.
Is it still somehow possible to run this code with n = 100? Mine returns "Interupt" error.
That is Bad Practice! What about if n == 100? :) Your program will kill itself.
Very nice
Thanks!
I also found this useful for anyone newer
https://www.youtube.com/watch?v=zg-ddPbzcKM
This is an example of recursion. The concept is present in many programming languages, and mathematics in general.
The equation for a single fibonacci number is dependent on the two previous fibonacci numbers (for all but n == 1 && n == 2). These are determined by either:
n
value that acts as a seed. These seed values are required to prevent infinite recursion, and are implemented as the following lines in this solution:For a ruby specific explanation of recursion, check out this StackOverflow Post.
For a more broad, mathematical explanation (including fibonacci numbers) see the wiki article on Recurrence relations.
Can someone explain how this works?
Newer to ruby and don't understand this method with a method call...?
nth_fibonacci(n-1)+nth_fibonacci(n-2)
or /A-z/
I like this one because recursion. Also cause we did that same thing :P
This comment is hidden because it contains spoiler information about the solution
Loading more items...