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.
The instructions need to outline better that we need to handle the case where no arguements are passed to the method.
All my tests pass except for should work with 0 for n. I am able to get an empty array when I pass in 0 as n in my own tests. In the 'should work with 0 for n' test I get the error message:
prefill'
block (2 levels) in'
I don't get this on any other
Bravo, love that its been broken out into a class.
Clever use of indexes w/ the scores and uniq.count to determine whether a pair or tripplet exist. Converting the result from their name to numbers early on made it a bit difficult to follow the steps inside the if-statement since you have to call the score of the number rather than it's name.
Interesting solution using binomial series simplification. What is interesting here is that m = (n^2*(n+1)^2)/4 . When I try to simplify n in terms of m would be n*(n+1) = sqrt(m * 4). However, if you assume that n is very small compared to m and that performing n.to_i will remove the error, then you can simplify further to n^2 = sqrt(m * 4) and thus get n = (m * 4)^(1/4). This is where the check to plug n back into the binomial simplication will confirm that assumption. I'm amazed that it will work and pretty cool!