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.
I know the test cases don't cover it, but what if at least one of them was 0? ;-)
If the resulting array is empty, calling
first
will yieldnil
, which needs to be converted into0
. This can be done either by usingto_i
or|| 0
.Why would .to_i be necessary? The array consists of integers only.
Copied this over from SO, didn't have a lot of time to work through the math. This is a very cool problem, several of the better answers are worth studying in some depth.
Honestly, in actual production coding-for-real-money-as-a-career, deciphering verbal gimmicks, as in "WTF is Product/CEO/Marketing talking about?" seems to be the main part of being an experienced senior engineer.
This comment is hidden because it contains spoiler information about the solution
Thank you.
Thanks for checking, still no love for me, but I'm feeling more inspired to see how fast I can get it in Ruby.
The tests are working correctly. Re-raised the issue about bad test setup.
s/sum/product/
Duplicate issue.
There is already an issue raised from 4 years ago, the author is long gone.
Need to specify how no argument is handled.
For anyone wondering why this might be useful, I've to implement and debug long, complex SQL queries generated from hierarchal ActiveRecord models.
Intensely tedious and nitpicky work.
FWIW, my opinion at the time, and my current opinion, is that was the wrong way to do it.
This is pretty interesting comment as I've written a fair bit of code, in Ruby, in the last month, using regexes, to prevent sql injection.
But at 8 kyu, I am unable to understand what is required to pass the specs, and cannot justify any further time to figure it out. There are much more interesting problems which are much better worded.
Perhaps this problem just doesn't work as described in Ruby? Could it be removed? Deprecated?
Loading more items...