Ad
  • Custom User Avatar

    The instructions need to outline better that we need to handle the case where no arguements are passed to the method.

  • Custom User Avatar

    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

  • Custom User Avatar

    Bravo, love that its been broken out into a class.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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!