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.
Yup. You can create a function to generate the nth element of a lot of recurrence relations.
Haters gonna hate.
I don't think this is too hard. 5 kyu?
Absolutely. That's a great addition to the test cases. Added it now. Thanks for reporting!
Just to be clear, my previous post was in regards to scrabbledude's comment, not boatmeme's. That would have seemed a bit arrogant :P
Of course! I absolutely agree with that statement.
If the constraint hadn't been defined I would have done it with an algo. However, with clearly defined limits like that (which you typically have in computer science problems) I think a lookup table is a good solution. The solution is fast, the code is easy to understand and it's fast to write.
I don't see why a lookup table is a bad thing though.
From the description: "We promise never to ask for any primes over 5000."
Really enjoy these class katas!
The correct way to do it with shorthand notation is the way x-ray did it.
My solution breaks if you give [undefined,'a', 'a', 'b', 'a','a'] as the array to the solution function. You probably want my solution to fail.
The first kata I ever made. Thanks for playing, and please comment if you have any ideas for improvements! :)
I was thinking about doing this as well, then chickened out... Kudos! ;)
Just learned about the reduce method. This is going to come in handy in future Katas.
I found the upvote button. Thanks! :)
Look at the name of the function you're trying to bugfix, and play around with the code. It's pretty obvious once you get some debugging going. console.log cannot be underestimated. ;)
Loading more items...