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 don't really know what's wrong in your code, but apparently, codewars accepts it if you use directly
n
, instead of declaring a new variablenumber = n
.But I have no idea why this happens...
This comment is hidden because it contains spoiler information about the solution
Done! :D
Could you tell me in which language this error occours, please?
Approved :)
I think it is fixed now. :) Thanks for reporting.
There should be no empty vectors.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I also agree. It use to be hard for me to do a 5 kyu, or even 6 kyu, and this seemed very easy to me.
You need to create a function
solution(number)
wich returns the sum of every0 < n < number
such thatn
is multiple of 3 or 5.For example,
solution(10)
Multiples of 3 that are
< 10
: 3, 6, 9Multiples of 5 that are
< 10
: 5Result: 3+6+9+5 = 23
So
solution(10) returns 23
.You need to create a function
solution(number)
wich returns the sum of every0 < n < number
such thatn
is multiple of 3 or 5.For example,
solution(10)
Multiples of 3 that are
< 10
: 3, 6, 9Multiples of 5 that are
< 10
: 5Result: 3+6+9+5 = 23
So
solution(10) returns 23
.In the discription it is said that you don't need to worry about empty arrays or vectors.
Done :)
Thank you! After some time I finally got it! :)
This comment is hidden because it contains spoiler information about the solution
Loading more items...