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.
Does not work properly when a negative number is given
You could also do (0...number) instead of (1...number)
Interesting! I was not aware of the range syntax with 3 dots, where 1...n exludes the end of the range.
This comment is hidden because it contains spoiler information about the solution
O my love. So beautiful
short and pithy,easy to read
Not computation efficient.
I think it should use math to solve this.
Good catch. Thanks.
This returns
nil
whennumber < 3
.It would probably be best to add
|| 0
onto the end of line 2.I wouldn't really say this is a best practice. To me best practice is the code that runs with the highest efficiency, this one ran in 136ms when I checked it.
The code will work, but looping through n times is unneccessary.
You could make the code more efficient. Just think: you only care about the multiples of 3 and 5