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.
This comment is hidden because it contains spoiler information about the solution
it's still important to instill those concepts so that when you get to the more difficult, complicated real world problems, those concerns are on your mind.
It's a trivial problem with no real implications outside the kata world. I think the servers will survive a little extra work... 1000 runs with this algorithm clocks in at 0.035s. Yours takes 0.023s less ;)
Mmmmmkay
wow, ur a genius!
This is not beautiful, it is a waste of processing resources. Sorting every word is awful. Just Hash it with O(n). Sorting is O(nlog(n))
That's why I threw a quick "ary = words.chars and" in front of my words.select
very clever
How about
(n - 2).times
and returningb
?Nice one-liner, but you are wasting a lot of cycles repeatedly calling "word.chars.sort". I would recommend assigning that to a variable right off and then use that variable in your select.
I had a similar recursive approach but it game me error : stack level too deep
I posted a solution which was correct (Validated after forfeiting), yet when I 'attempted' the solution it kept saying '1-st Fibo' to me, I am not sure what that was about.