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
reduce
will throw an error, I suppose. A more correct answer would change the end to:To be fair, most real world, practical problems have more complex and less elegant solution requirements. This is a simple, elegant problem, and I figured it called for a simple, elegant solution. Plus, I disagree that this is less readable than the 4-5 line for loop/if block solutions- There's hardly any control flow to speak of, so it requires less effort to track how the algorithm works. It's just two simple data manipulation operations.
Also, your brain may like inclusive, but you'll be chasing fencepost errors for the rest of your life.
"Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in."