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.
Correction:
I believe turbofish (or type annotation) is necessary because the type of
divs
needs to be known at point ofdivs.len()
call.Tested with
1.50.0
.It is waste of resources to go for full
2..integer
as if we know that ifn
dividesinteger
theninteger / n
divides it as well asa / b = c <=> a / c = b
. So instead of going for full range we can go up tosqrt(integer)
.Another thing is that turbofish operator in
collect
is completely unneeded as it can be deduced by the compilator from return type.This is awesome! I love how you used the filter and collect functions, but you could have gotten away with limiting the size of the range to (2..(integer/2)+1).