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.
Most of the names are different, so just for consistency, although either way looks OK.
I folded in the wrong direction earlier, should have done this
for early exiting. (I can't just quickly imagine the evaluation order without doing it step by step on paper, but, whatever the reason is, this version is faster. Maybe it's just the usual stricter evaluation thing.)Another thing is too much laziness, all those lists and maybes there, see the other fork.
One thing is there's no early exit here (check the fork).
Input distribution to optimize for isn't specified, so it's unclear if densness is good or bad. It's not slower for the "biased random tests", in which density is always about 100%.
Result<T, ()>
is isomorphic toOption<T>
, does it have any advantages?I'm not sure if
n % divisor != 0
is possible without more complicated stuff with high-precision fractions, but I have a version of the solution that seems to work for all other input.And the reference solution is wrong for many other cases: (9, 9) -> expected 60, (15, 15) -> expected 2192. I sumbitted this version to see what should be done to generalize it and wasn't really expecting it to pass all the tests.
This assumes one particular implementation, while the rest of the description is just a math problem. Oversimplified, it's like "check if the number is even or odd, but you'll be given only numbers divisible by 3 to make sure the output is correct". It may be a valid constraint, but it's not the way to describe it.
A number of sets is always an integer, which is exact, so I think this statement should be reworded.
(2, 2) isn't tested, but it's still valid input according to the description.
[T]
is notIntoIterator
andDeref
coercion isn't applicable.This looks familiar, might be a duplicate, but I can't find it now.
6
is the length, the meaning of5
would be less clear. With the length, it's like indexing a full array from the end with.at(-ir)
.There's no year 0 in the Gregorian calendar.
Decimal
is a type, "decimal" is a base, "floating point" is... representation? or whatever it's called. "Decimal" is orthogonal to "floating point".Decimal
is a floating point decimal number.Loading more items...